ci: fix deploy.yml and consolidate workflows
Fix YAML indentation (on:/jobs: were nested under name:), correct image name from shcizo/myapp to shcizo/pdga-rating, switch registry auth from GITEA_TOKEN to PACKAGES_TOKEN (auto-injected token lacks effective registry access), and add packages:write permission. Remove docker-build.yml since deploy.yml now covers build + push + deploy in one workflow — previously both triggered on tag push and raced for the same image tags.
This commit is contained in:
+36
-33
@@ -1,39 +1,42 @@
|
|||||||
name: Build and deploy
|
name: Build and deploy
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- "v*"
|
- "v*"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push:
|
build-and-push:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
permissions:
|
||||||
- uses: actions/checkout@v4
|
contents: read
|
||||||
|
packages: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Login to Gitea registry
|
- name: Login to Gitea registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: gitea.shcizo.se
|
registry: gitea.shcizo.se
|
||||||
username: ${{ gitea.actor }}
|
username: ${{ gitea.actor }}
|
||||||
password: ${{ secrets.GITEA_TOKEN }}
|
password: ${{ secrets.PACKAGES_TOKEN }}
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: |
|
||||||
gitea.shcizo.se/shcizo/myapp:${{ gitea.ref_name }}
|
gitea.shcizo.se/shcizo/pdga-rating:${{ gitea.ref_name }}
|
||||||
gitea.shcizo.se/shcizo/myapp:latest
|
gitea.shcizo.se/shcizo/pdga-rating:latest
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [build-and-push]
|
needs: [build-and-push]
|
||||||
steps:
|
steps:
|
||||||
- uses: shcizo/package-updater-action@v1
|
- uses: shcizo/package-updater-action@v1
|
||||||
with:
|
with:
|
||||||
endpoint: https://updater.shcizo.se/update
|
endpoint: https://updater.shcizo.se/update
|
||||||
image: gitea.shcizo.se/shcizo/myapp
|
image: gitea.shcizo.se/shcizo/pdga-rating
|
||||||
tag: ${{ gitea.ref_name }}
|
tag: ${{ gitea.ref_name }}
|
||||||
token: ${{ secrets.UPDATER_TOKEN }}
|
token: ${{ secrets.UPDATER_TOKEN }}
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
name: Docker Build
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- 'v*'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
docker:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: gitea.shcizo.se
|
|
||||||
username: ${{ gitea.actor }}
|
|
||||||
password: ${{ secrets.PACKAGES_TOKEN }}
|
|
||||||
|
|
||||||
- uses: docker/metadata-action@v5
|
|
||||||
id: meta
|
|
||||||
with:
|
|
||||||
images: gitea.shcizo.se/shcizo/pdga-rating
|
|
||||||
tags: |
|
|
||||||
type=semver,pattern={{version}}
|
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
|
||||||
type=raw,value=latest
|
|
||||||
|
|
||||||
- uses: docker/build-push-action@v6
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
Reference in New Issue
Block a user