Merge pull request #34 from ScilifelabDataCentre/slu_rsv #73
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Docker Image | |
on: | |
workflow_dispatch: {} | |
push: | |
branches: | |
- master | |
- develop | |
release: | |
types: [published] | |
jobs: | |
push_to_registry: | |
if: github.repository == 'ScilifelabDataCentre/dc-dynamic' | |
name: Publish Docker Image | |
runs-on: ubuntu-latest | |
concurrency: | |
group: ${{ github.ref }}-docker-build | |
cancel-in-progress: true | |
strategy: | |
matrix: | |
include: | |
- dockerfile: Dockerfiles/Dockerfile.backend | |
images: | | |
ghcr.io/scilifelabdatacentre/dc-dynamic | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
# only needed when publishing to Github (ghcr.io) | |
- name: Log in to Github Container Repository | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
# will run as the user who triggered the action, using its token | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker Meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ matrix.images }} | |
tags: | | |
type=ref,event=branch | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
- name: Build and Publish | |
uses: docker/build-push-action@v3 | |
with: | |
file: Dockerfile | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |