Add deployment workflow
- Moves deployment steps into the CI workflow. - Removes the separate deploy workflow file. - Adds a dependency on the test job. - Only deploys on the master branch. - Logs into DockerHub and Gitea registries. - Sets up Docker Buildx and builds/pushes the image.
This commit is contained in:
parent
bc48d157f7
commit
e81b935f33
@ -27,6 +27,7 @@ jobs:
|
||||
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
needs: lint
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
@ -43,3 +44,26 @@ jobs:
|
||||
|
||||
- name: Upload to Codecov
|
||||
run: bash <(curl -s https://codecov.io/bash)
|
||||
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
needs: test
|
||||
if: github.ref == 'refs/heads/master'
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Log in to DockerHub
|
||||
run: echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin
|
||||
|
||||
- name: Log in to Gitea Registry
|
||||
run: echo "${{ vars.REPOSITORY_TOKEN }}" | docker login git.rogs.me -u rogs --password-stdin
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Build and push image
|
||||
run: |
|
||||
docker buildx build --push \
|
||||
--tag rogsme/cleanmedia:latest \
|
||||
--tag git.rogs.me/rogs/cleanmedia:latest \
|
||||
.
|
||||
|
@ -1,31 +0,0 @@
|
||||
name: Deploy to DockerHub & Gitea
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["CI"]
|
||||
types:
|
||||
- completed
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' && github.ref == 'refs/heads/master' }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Log in to DockerHub
|
||||
run: echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin
|
||||
|
||||
- name: Log in to Gitea Registry
|
||||
run: echo "${{ vars.REPOSITORY_TOKEN }}" | docker login git.rogs.me -u rogs --password-stdin
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Build and push image
|
||||
run: |
|
||||
docker buildx build --push \
|
||||
--tag rogsme/cleanmedia:latest \
|
||||
--tag git.rogs.me/rogs/cleanmedia:latest \
|
||||
.
|
Loading…
x
Reference in New Issue
Block a user