on:
push:
- branches: dev
+ branches: master
paths:
- 'src/Impostor.Server/**'
- 'src/Impostor.Shared/**'
run: |
DOCKER_IMAGE=aeonlucid/impostor
VERSION=noop
+ VERSIONSUFFIX=docker
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
+ VERSIONSUFFIX=
elif [[ $GITHUB_REF == refs/heads/* ]]; then
- VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
- if [ "${{ github.event.repository.default_branch }}" = "dev" ]; then
- VERSION=nightly
- fi
+ VERSION=nightly
+ VERSIONSUFFIX=docker.${{ github.run_number }}
elif [[ $GITHUB_REF == refs/pull/* ]]; then
VERSION=pr-${{ github.event.number }}
+ VERSIONSUFFIX=pr.${{ github.event.number }}
fi
TAGS="${DOCKER_IMAGE}:${VERSION}"
if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
fi
echo ::set-output name=version::${VERSION}
echo ::set-output name=tags::${TAGS}
+ echo ::set-output name=versionsuffix::${VERSIONSUFFIX}
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
platforms: linux/amd64,linux/arm/v7,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.prep.outputs.tags }}
+ build-args: |
+ VERSIONSUFFIX=${{ steps.prep.outputs.versionsuffix }}
# https://github.com/containerd/containerd/blob/master/platforms/platforms.go#L17
ARG TARGETARCH
+ARG VERSIONSUFFIX
+
WORKDIR /source
# Copy csproj and restore.
arm) NETCORE_PLATFORM='linux-arm';; \
*) echo "unsupported architecture"; exit 1 ;; \
esac && \
- dotnet publish -c release -o /app -r "$NETCORE_PLATFORM" --no-restore ./src/Impostor.Server/Impostor.Server.csproj
+ dotnet publish -c release -o /app -r "$NETCORE_PLATFORM" -p:VersionSuffix="$VERSIONSUFFIX" --no-restore ./src/Impostor.Server/Impostor.Server.csproj
# Final image.
FROM --platform=$TARGETPLATFORM mcr.microsoft.com/dotnet/runtime:5.0