#156: Added exit code 1 to .bat scripts #5
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: Create and publish SHACL API Docker image | |
on: | |
release: | |
type: [published] | |
push: | |
branches: [master] | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# https://github.com/docker/setup-qemu-action | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # v2.1.0 | |
# https://github.com/docker/setup-buildx-action | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@15c905b16b06416d2086efa066dd8e3a35cc7f98 # v2.4.0 | |
# inspired by https://github.com/reloc8/action-latest-release-version | |
- name: Get release version | |
id: get_version | |
run: | | |
git fetch --tags | |
git fetch --prune --unshallow || true | |
LATEST_RELEASE=$(git describe --abbrev=0 --tags | sed 's/^v//') | |
echo "latest-release=${LATEST_RELEASE}" >> $GITHUB_OUTPUT | |
echo "version_build=${LATEST_RELEASE}_"$(git rev-parse --short "$GITHUB_SHA") >> $GITHUB_OUTPUT | |
# https://github.com/docker/metadata-action | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@507c2f2dc502c992ad446e3d7a5dfbe311567a96 #v4.3.0 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=raw,value=latest,enable=${{ github.event_name == 'push' }} | |
type=raw,value=${{ steps.get_version.outputs.version_build}},enable=${{ github.event_name == 'push' }} | |
type=raw,value=${{ steps.get_version.outputs.latest-release}},enable=${{ github.event_name == 'release' }} | |
# https://github.com/docker/login-action | |
- name: Log in to the Container registry | |
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# https://github.com/docker/build-push-action | |
- name: Build and push Docker image | |
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 #v4.0.0 | |
with: | |
file: .docker/Dockerfile | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: VERSION=${{ steps.get_version.outputs.version_build }} | |
outputs: type=image |