Merge pull request #42 from albertrdixon/albertrdixon/flag-env-vars #29
Workflow file for this run
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 | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+' | |
paths-ignore: | |
- 'docs/**' | |
- '*.md' | |
jobs: | |
release: | |
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 | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ secrets.DOCKER_REGISTRY }} | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.CR_PAT }} | |
- name: Available platforms | |
run: echo "${{ steps.buildx.outputs.platforms }}" | |
- name: Decide on image name | |
id: nomenclator | |
env: | |
DOCKER_REPOSITORY: ${{ secrets.DOCKER_REPOSITORY }} | |
run: | | |
name=${DOCKER_REPOSITORY} | |
if [ -z "$name" ]; then | |
name=${{ github.repository }} | |
fi | |
echo ::set-output name=name::${name} | |
echo ::debug::docker image name ${name} | |
- name: Decide on tag | |
id: tagger | |
run: | | |
tag=$(echo "${{ github.ref }}" | sed -e 's/^refs\/heads\///g' -e 's/^refs\/tags\///g' -e 's/^refs\/pull\///g' -e 's/\/merge$//g' | sed -e 's/master/latest/g') | |
echo "::set-output name=tag::${tag}" | |
echo "::debug::docker image tag ${tag}" | |
- name: Build and push Docker image | |
id: build-push | |
uses: docker/build-push-action@v3 | |
with: | |
build-args: VERSION=${{ steps.tagger.outputs.tag }} | |
platforms: linux/amd64,linux/arm64 | |
tags: | | |
${{ steps.nomenclator.outputs.name }}:${{ steps.tagger.outputs.tag }} | |
${{ steps.nomenclator.outputs.name }}:latest | |
ghcr.io/${{ github.repository }}:${{ steps.tagger.outputs.tag }} | |
ghcr.io/${{ github.repository }}:latest | |
push: true | |
- name: Image digest | |
run: echo "${{ steps.build-push.outputs.digest }}" |