Update image tag in action
All checks were successful
Build and Deploy / build-and-push (push) Successful in 26s
All checks were successful
Build and Deploy / build-and-push (push) Successful in 26s
This commit is contained in:
@@ -15,19 +15,44 @@ jobs:
|
|||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Login to Gitea Registry
|
- name: Login to Gitea
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: git.ulfrx.dev
|
registry: git.ulfrx.dev
|
||||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
username: ${{ secrets.GIT_USERNAME }}
|
||||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
password: ${{ secrets.GIT_TOKEN }}
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
tags: git.ulfrx.dev/ulfr/recipe-mockup:latest
|
tags: |
|
||||||
|
git.ulfrx.dev/ulfr/recipe-mockup:latest
|
||||||
|
git.ulfrx.dev/ulfr/recipe-mockup:${{ github.sha }}
|
||||||
|
|
||||||
|
- name: Update image tag in infra repo
|
||||||
|
run: |
|
||||||
|
REPO="ulfr/homelab"
|
||||||
|
FILE_PATH="stacks/recipe-mockup/docker-compose.yaml"
|
||||||
|
NEW_TAG="${{ github.sha }}"
|
||||||
|
API_URL="https://git.ulfrx.dev/api/v1/repos/${REPO}/contents/${FILE_PATH}"
|
||||||
|
|
||||||
|
RESPONSE=$(curl -fsS \
|
||||||
|
-H "Authorization: token ${{ secrets.GIT_TOKEN }}" \
|
||||||
|
"${API_URL}")
|
||||||
|
|
||||||
|
FILE_SHA=$(echo "$RESPONSE" | jq -r '.sha')
|
||||||
|
CONTENT=$(echo "$RESPONSE" | jq -r '.content' | base64 -d)
|
||||||
|
|
||||||
|
UPDATED=$(echo "$CONTENT" | sed "s|git.ulfrx.dev/ulfr/recipe-mockup:[a-zA-Z0-9._-]*|git.ulfrx.dev/ulfr/recipe-mockup:${NEW_TAG}|g")
|
||||||
|
ENCODED=$(echo "$UPDATED" | base64 -w 0)
|
||||||
|
|
||||||
|
curl -fsS -X PUT \
|
||||||
|
-H "Authorization: token ${{ secrets.GIT_TOKEN }}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{\"message\":\"deploy: recipe-mockup ${NEW_TAG::7}\",\"content\":\"${ENCODED}\",\"sha\":\"${FILE_SHA}\"}" \
|
||||||
|
"${API_URL}"
|
||||||
|
|
||||||
- name: Trigger Dockhand redeploy
|
- name: Trigger Dockhand redeploy
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
Reference in New Issue
Block a user