Merge pull request #60 from swiss-art-research-net/rs-new-design #49
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: Docker Image CI | |
on: | |
push: | |
branches: [ "master", "develop" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- | |
name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
name: Extract branch name | |
shell: bash | |
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >>$GITHUB_OUTPUT | |
id: extract_branch | |
- | |
name: Build and push with SHA tag | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: swissartresearx/researchspace:${{github.sha}} | |
cache-from: type=registry,ref=swissartresearx/researchspace:latest | |
cache-to: type=inline | |
- | |
name: Build and push with latest tag | |
uses: docker/build-push-action@v4 | |
if: github.ref == 'refs/heads/master' | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: swissartresearx/researchspace:latest | |
cache-from: type=registry,ref=swissartresearx/researchspace:latest | |
cache-to: type=inline | |
- | |
name: Build and push for develop | |
uses: docker/build-push-action@v4 | |
if: contains('refs/heads/develop', github.ref) | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: swissartresearx/researchspace:${{ steps.extract_branch.outputs.branch }} | |
cache-from: type=registry,ref=swissartresearx/researchspace:latest | |
cache-to: type=inline |