chore: fix missing single quote in docs (#734) #139
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 Release | |
on: | |
push: | |
tags: | |
- '*' | |
branches: | |
- master | |
permissions: | |
contents: read | |
jobs: | |
init: | |
permissions: | |
contents: none | |
runs-on: ubuntu-latest | |
outputs: | |
do_docker: ${{ steps.vars.outputs.IS_DOCKERHUB_PUSH }} | |
steps: | |
- name: Initialize workflow variables | |
shell: bash | |
run: | | |
# work-around for inaccessible 'secrets' object for 'if'; see <https://git.luolix.topmunity/t5/GitHub-Actions/jobs-lt-job-id-gt-if-does-not-work-with-env-secrets/m-p/38549>) | |
unset IS_DOCKERHUB_PUSH | |
if [ -z "$DOCKERHUB_PUSH" ]; then IS_DOCKERHUB_PUSH='false'; else IS_DOCKERHUB_PUSH='true' ; fi | |
echo set-output name=IS_DOCKERHUB_PUSH::${IS_DOCKERHUB_PUSH} | |
echo ::set-output name=IS_DOCKERHUB_PUSH::${IS_DOCKERHUB_PUSH} | |
env: | |
DOCKERHUB_PUSH: ${{ secrets.DOCKERHUB_PUSH }} | |
build: | |
name: Build and push Docker image | |
runs-on: ubuntu-latest | |
needs: [init] | |
if: ${{ needs.init.outputs.do_docker == 'true' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Build and push latest | |
uses: docker/build-push-action@v2 | |
if: github.ref == 'refs/heads/master' | |
with: | |
push: true | |
tags: ${{ secrets.DOCKERHUB_REPO }}:latest | |
- name: Set version variable | |
id: version | |
if: startsWith(github.ref, 'refs/tags/') | |
run: echo ::set-output name=TAG::${GITHUB_REF#refs/tags/} | |
- name: Build and push tag | |
uses: docker/build-push-action@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
push: true | |
tags: ${{ secrets.DOCKERHUB_REPO }}:${{ steps.version.outputs.TAG }} |