Compare commits

..

26 Commits

Author SHA1 Message Date
ThaMunsta
80a2f51f98 global envs?
All checks were successful
Just test things / Pull-and-run (push) Successful in 28s
2025-03-16 16:40:33 -04:00
ThaMunsta
2049389ef4 helps if i spell right
All checks were successful
Just test things / Pull-and-run (push) Successful in 11s
2025-03-16 15:22:50 -04:00
ThaMunsta
1d22a80841 Merge branch 'tests' 2025-03-16 15:21:40 -04:00
ThaMunsta
933464003e just path? 2025-03-16 15:21:27 -04:00
ThaMunsta
84ecb4f6eb add echo 2025-03-16 15:19:07 -04:00
ThaMunsta
b94be64f28 tests 2025-03-16 15:18:33 -04:00
ThaMunsta
d814570426 i take that back. this is actually a weird usecase. 2025-03-16 15:11:33 -04:00
ThaMunsta
d9fca1201d deploy existing on push stack file? 2025-03-16 15:10:06 -04:00
ThaMunsta
a7bf3cd84d ready to deploy
All checks were successful
Gitea Actions Demo / Create-Stack (push) Successful in 15s
2025-03-16 15:03:15 -04:00
ThaMunsta
bcfbe05a88 fixed ok now only deploy when push tag 2025-03-16 15:02:46 -04:00
ThaMunsta
18ae6ea41f oh a string ffs
All checks were successful
Gitea Actions Demo / Create-Stack (push) Successful in 18s
2025-03-16 15:01:44 -04:00
ThaMunsta
26c578b638 idk
All checks were successful
Gitea Actions Demo / Create-Stack (push) Successful in 10s
2025-03-16 14:56:01 -04:00
ThaMunsta
7d30f715c5 args
All checks were successful
Gitea Actions Demo / Create-Stack (push) Successful in 10s
2025-03-16 14:45:14 -04:00
ThaMunsta
3079744b7f quotes
Some checks failed
Gitea Actions Demo / Create-Stack (push) Failing after 11s
2025-03-16 14:43:51 -04:00
ThaMunsta
e86405d564 init stack
Some checks failed
Gitea Actions Demo / Create-Stack (push) Failing after 10s
2025-03-16 14:43:05 -04:00
ThaMunsta
a2b1b45000 fix job
All checks were successful
Gitea Actions Demo / Create-Stack (push) Successful in 12s
2025-03-16 14:38:34 -04:00
ThaMunsta
28d3511623 init stack!
All checks were successful
Gitea Actions Demo / Create-Stack (push) Successful in 10s
2025-03-15 22:05:52 -04:00
ThaMunsta
fc6a6ecb55 test
All checks were successful
Gitea Actions Demo / Create-Stack (push) Successful in 12s
2025-03-15 22:02:13 -04:00
ThaMunsta
844a8eff34 updates 2025-03-15 22:00:53 -04:00
987c154021 Merge pull request 'init-stack' (#7) from init-stack into main
Reviewed-on: #7
2025-03-16 01:47:06 +00:00
ThaMunsta
23d0d0750d test 2025-03-15 21:43:11 -04:00
ThaMunsta
e9f21838e6 updates 2025-03-15 21:42:32 -04:00
ThaMunsta
52f1c80b29 updates 2025-03-15 21:39:50 -04:00
ThaMunsta
68279e1ade update 2025-03-15 21:39:31 -04:00
ThaMunsta
ef3d08e852 init 2025-03-15 21:38:40 -04:00
ThaMunsta
3317969f8a del 2025-03-15 21:37:50 -04:00
4 changed files with 17 additions and 154 deletions

View File

@@ -3,10 +3,8 @@ name: Gitea Actions Demo
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
on:
push:
branches:
- 'stack-init'
paths:
- 'stack.yml'
tags:
- init-stack
jobs:
Create-Stack:
@@ -16,7 +14,7 @@ jobs:
- name: Checkout
uses: https://github.com/actions/checkout@v4
with:
ref: stack-init
ref: main
- name: Get the endpoint ID
# Usually ID is 1, but you can get it from the API. Only skip this if you are VERY sure.
@@ -39,14 +37,16 @@ jobs:
STACK_FILE_CONTENT=$(echo "$(<stack.yml )")
# Prepare JSON payload
JSON_PAYLOAD=$(jq -n --arg stackFileContent "$STACK_FILE_CONTENT" \
'{stackFileContent: $stackFileContent}')
JSON_PAYLOAD=$(jq -n \
--arg stackFileContent "$STACK_FILE_CONTENT" \
--arg name "$STACK_NAME" \
'{stackFileContent: $stackFileContent, name: $name}')
echo "About to push the following JSON payload:"
echo $JSON_PAYLOAD
# Update stack in Portainer (this redeploys it)
DEPLOY_RESPONSE=$(curl -X POST "$PORTAINER_API_URL/stacks/$STACK_ID?endpointId=$ENDPOINT_ID" \
DEPLOY_RESPONSE=$(curl -X POST "$PORTAINER_API_URL/stacks/create/standalone/string?endpointId=$ENDPOINT_ID" \
-H "X-API-Key: $PORTAINER_TOKEN" \
-H "Content-Type: application/json" \
--data "$JSON_PAYLOAD")

View File

@@ -1,142 +0,0 @@
name: TournamentCaddie Prod Deploy
on:
push:
branches:
- master
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker registry
uses: docker/login-action@v1
with:
registry: reg.dev.nervesocket.com
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} # This is a secret field, add your Docker Hub password here as a GitHub secret
- name: Build and push docker image
id: build
run: |
docker buildx build --tag reg.dev.nervesocket.com/tournamentcaddie:latest .
docker push reg.dev.nervesocket.com/tournamentcaddie:latest # This will tag and push the image to your Docker registry
- name: Update docker stack
run: |
docker pull reg.dev.nervesocket.com/tournamentcaddie:latest # This is just an example, you would need to replace this with the correct command for updating your docker stack
name: Deploy TournamentCaddie
on:
push:
branches:
- main
jobs:
deploy:
runs-on: self-hosted
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Log in to private registry
run: |
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login reg.dev.nervesocket.com -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin
- name: Build and push Docker image
run: |
IMAGE_TAG="reg.dev.nervesocket.com/tournamentcaddie:latest"
docker build -t $IMAGE_TAG .
docker push $IMAGE_TAG
- name: Fetch stack ID from Portainer
run: |
STACK_NAME="TournamentCaddie"
PORTAINER_API_URL="http://portainer:9000/api"
PORTAINER_TOKEN="${{ secrets.PORTAINER_API_KEY }}"
STACK_ID=$(curl -s -H "Authorization: Bearer $PORTAINER_TOKEN" "$PORTAINER_API_URL/stacks" | jq -r ".[] | select(.Name==\"$STACK_NAME\") | .Id")
echo "STACK_ID=$STACK_ID" >> $GITHUB_ENV
- name: Trigger stack update in Portainer
run: |
PORTAINER_API_URL="http://portainer:9000/api"
PORTAINER_TOKEN="${{ secrets.PORTAINER_API_KEY }}"
curl -X POST "$PORTAINER_API_URL/stacks/$STACK_ID/redeploy" \
-H "Authorization: Bearer $PORTAINER_TOKEN" \
-H "Content-Type: application/json" \
--data '{"pullImage": true}'
name: Deploy TournamentCaddie
on:
push:
branches:
- main
jobs:
deploy:
runs-on: self-hosted
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Log in to private registry
run: |
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login reg.dev.nervesocket.com -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin
- name: Build and push Docker image
run: |
IMAGE_TAG="reg.dev.nervesocket.com/tournamentcaddie:latest"
docker build -t $IMAGE_TAG .
docker push $IMAGE_TAG
- name: Fetch stack ID from Portainer
run: |
STACK_NAME="TournamentCaddie"
PORTAINER_API_URL="http://portainer:9000/api"
PORTAINER_TOKEN="${{ secrets.PORTAINER_API_KEY }}"
STACK_ID=$(curl -s -H "Authorization: Bearer $PORTAINER_TOKEN" "$PORTAINER_API_URL/stacks" | jq -r ".[] | select(.Name==\"$STACK_NAME\") | .Id")
if [ -z "$STACK_ID" ]; then
echo "Error: Stack ID not found!"
exit 1
fi
echo "STACK_ID=$STACK_ID" >> $GITHUB_ENV
- name: Fetch stack configuration
run: |
PORTAINER_API_URL="http://portainer:9000/api"
PORTAINER_TOKEN="${{ secrets.PORTAINER_API_KEY }}"
# Get the stack details (including stack file content)
curl -s -H "Authorization: Bearer $PORTAINER_TOKEN" "$PORTAINER_API_URL/stacks/$STACK_ID/file" \
| jq -r '.StackFileContent' > stack.yml
- name: Redeploy stack in Portainer
run: |
PORTAINER_API_URL="http://portainer:9000/api"
PORTAINER_TOKEN="${{ secrets.PORTAINER_API_KEY }}"
# Read stack file content
STACK_FILE_CONTENT=$(jq -Rs . < stack.yml)
# Prepare JSON payload
JSON_PAYLOAD=$(jq -n --arg stackFileContent "$STACK_FILE_CONTENT" --argjson pullImage true \
'{stackFileContent: $stackFileContent, pullImage: $pullImage}')
# Update stack in Portainer (this redeploys it)
curl -X PUT "$PORTAINER_API_URL/stacks/$STACK_ID" \
-H "Authorization: Bearer $PORTAINER_TOKEN" \
-H "Content-Type: application/json" \
--data "$JSON_PAYLOAD"

View File

@@ -2,9 +2,12 @@
name: Just test things
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
on:
pull_request:
branches:
- test-cmd
push:
paths:
- '**tests.yaml'
env:
TEST: "Hello World!"
jobs:
Pull-and-run:
@@ -20,3 +23,5 @@ jobs:
STACK_NAME: whoami
run: |
ls -la
echo "done"
echo $TEST

View File

@@ -8,4 +8,4 @@ services:
environment:
- TZ=America/Toronto
ports:
- 1111:80
- 1122:80