Merge branch 'master' of github.com:jaedb/snapserver #14
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 build and release | |
on: | |
release: | |
types: [published] | |
push: | |
branches: [master,develop] | |
jobs: | |
deploy_image: | |
name: 'Publish: DockerHub' | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Extract branch name | |
shell: bash | |
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | |
id: extract_branch | |
- name: Generating release tags and labels | |
if: github.event_name == 'release' | |
id: release_meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: jaedb/snapserver | |
tags: | | |
latest | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
- name: Generating edge branch labels | |
if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' | |
id: edge_meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: jaedb/snapserver | |
tags: ${{ steps.extract_branch.outputs.branch }} | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
tags: ${{ steps.release_meta.outputs.tags || steps.edge_meta.outputs.tags }} | |
labels: ${{ steps.release_meta.outputs.labels || steps.edge_meta.outputs.tags }} |