Skip to content

Commit

Permalink
Merge pull request #151 from ImperialCollegeLondon/publish
Browse files Browse the repository at this point in the history
Publish docker on release
  • Loading branch information
tsmbland authored Oct 24, 2023
2 parents a025cff + 72f20f7 commit f2f7395
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, pull_request, 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 f2f7395

Please sign in to comment.