azp: derive Build.Number from pipeline name (#575) #391
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
on: | |
push: | |
branches: | |
- main | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- run: | | |
FROM ${{ runner.arch == 'x64' && '--platform=linux/amd64' || runner.arch == 'arm64' && '--platform=linux/arm64' }} mcr.microsoft.com/dotnet/sdk:8.0 | |
COPY . ./ | |
RUN dotnet msbuild src/dir.proj -t:GenerateConstant && dotnet publish src/Runner.Client -c Release --no-self-contained -p:BUILD_OS=Any -p:RuntimeFrameworkVersion=8.0.0 -o /app | |
FROM mcr.microsoft.com/dotnet/aspnet:latest | |
COPY --from=0 /app/ /app/ | |
ENTRYPOINT [ "dotnet", "/app/Runner.Client.dll" ] | |
shell: cp {0} Dockerfile | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- | |
name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- run: | | |
echo "LOWNER<<EOF23" >> $GITHUB_ENV | |
echo $(echo "$OWNER" | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV | |
echo "EOF23" >> $GITHUB_ENV | |
shell: bash | |
env: | |
OWNER: ${{github.repository_owner}} | |
- | |
name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ghcr.io/${{env.LOWNER}}/gharun:latest |