Merge pull request #434 from neilcook/release_notes #32
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: 'Build minimal docker image' | |
on: | |
push: | |
jobs: | |
docker_test: | |
name: docker_test | |
runs-on: ubuntu-22.04 | |
env: | |
# Github.refname is wrong for pull requests - have to use head ref for them | |
MYREF: ${{ github.event.pull_request && github.head_ref || github.ref_name }} | |
PLATFORMS: linux/arm64,linux/amd64 | |
DOCKERFILE: docker/wforce_image/Dockerfile.minimal | |
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
IMAGE_NAME: wforce-minimal | |
DOCKER_ORGANIZATION_NAME: ${{ secrets.DOCKERHUB_ORGANIZATION_NAME }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: linux/arm64 | |
- name: Set up Docker Buildx for multi-platform builds | |
uses: docker/setup-buildx-action@v3 | |
with: | |
platforms: ${{ env.PLATFORMS }} | |
- name: Check for release tag | |
id: release_check | |
run: | | |
if [[ ${{ github.ref }} =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
echo "release=YES" >> $GITHUB_OUTPUT | |
fi | |
- name: Set short git commit SHA | |
id: vars | |
run: | | |
calculatedSha=$(git rev-parse --short ${{ github.sha }}) | |
echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV | |
- name: Login to Docker | |
if: steps.release_check.outputs.release == 'YES' || env.BRANCH_NAME == 'master' | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push to docker hub for releases with tag | |
id: release_build | |
if: ${{ steps.release_check.outputs.release == 'YES' }} | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ${{ env.DOCKERFILE }} | |
platforms: ${{ env.PLATFORMS }} | |
build-args: | | |
license=GPLv3 | |
git_revision=${{ env.COMMIT_SHORT_SHA }} | |
version=${{ env.MYREF }} | |
push: true | |
sbom: true | |
tags: | | |
${{ env.DOCKER_ORGANIZATION_NAME }}/${{ env.IMAGE_NAME }}:${{ env.MYREF }} | |
- name: Build and push to docker hub for master branch | |
id: master_build | |
if: ${{ env.BRANCH_NAME == 'master' }} | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ${{ env.DOCKERFILE }} | |
platforms: ${{ env.PLATFORMS }} | |
build-args: | | |
license=GPLv3 | |
git_revision=${{ env.COMMIT_SHORT_SHA }} | |
version=${{ env.MYREF }} | |
push: true | |
sbom: true | |
tags: | | |
${{ env.DOCKER_ORGANIZATION_NAME }}/${{ env.IMAGE_NAME }}:unstable |