Skip to content

Commit

Permalink
modify workflow to publish docker image on release
Browse files Browse the repository at this point in the history
  • Loading branch information
tsmbland committed Oct 24, 2023
1 parent 211a701 commit c12c5d7
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 23 deletions.
24 changes: 1 addition & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Test

on: [push]
on: [push, workflow_call]

jobs:
qa:
Expand All @@ -26,25 +26,3 @@ jobs:
run: pip install -r requirements-dev.txt
- name: Run tests
run: pytest

publish:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs: test
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get image metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
26 changes: 26 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
on: [release]

jobs:
test:
uses: ./.github/workflows/ci.yml

publish:
runs-on: ubuntu-latest
needs: test
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get image metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ steps.meta.outputs.tags }}

0 comments on commit c12c5d7

Please sign in to comment.