Skip to content

release: bump version to v0.24.1 #1184

release: bump version to v0.24.1

release: bump version to v0.24.1 #1184

Workflow file for this run

name: Build & Publish Image
on:
push:
branches: ["develop", "ci/*", "v*"]
tags: ["v*"]
paths: ["src/GZCTF/**"]
workflow_dispatch:
env:
# latest tag is only created for `v*.*.*` or `v*.*.*-patch.*` tags
RELEASE: ${{ startsWith(github.ref, 'refs/tags/v') && (contains(github.ref, 'patch') || !contains(github.ref, '-')) }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
defaults:
run:
working-directory: src/GZCTF
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
global-json-file: src/global.json
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Get current date time
id: datetime
uses: Kaven-Universe/github-action-current-date-time@v1
with:
format: "YYYY-MM-DDTHH:mm:ssZ"
- name: Docker setup QEMU
uses: docker/setup-qemu-action@v3
- name: Docker setup Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: gztime
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Aliyun Container Registry
uses: docker/login-action@v3
with:
registry: registry.cn-shanghai.aliyuncs.com
username: ${{ secrets.ALIYUN_USER }}
password: ${{ secrets.ALIYUN_PASSWORD }}
- name: Prebuild project
run: |
npm i -g pnpm
dotnet build "GZCTF.csproj" -c Release -o build
- name: Publish project
run: |
dotnet publish "GZCTF.csproj" -c Release -o publish/linux/amd64 -r linux-x64 --no-self-contained /p:PublishReadyToRun=true
# ignore arm64 for non-release tags
if [ "${{ env.RELEASE }}" = "true" ]; then
dotnet publish "GZCTF.csproj" -c Release -o publish/linux/arm64 -r linux-arm64 --no-self-contained /p:PublishReadyToRun=true
fi
env:
VITE_APP_BUILD_TIMESTAMP: ${{ steps.datetime.outputs.time }}
VITE_APP_GIT_SHA: ${{ github.sha }}
VITE_APP_GIT_NAME: ${{ github.ref_name }}
- name: Docker metadata action
uses: docker/metadata-action@v5
id: meta
with:
images: |
gztime/gzctf
ghcr.io/${{ github.repository }}/gzctf
registry.cn-shanghai.aliyuncs.com/gztime/gzctf
flavor: |
latest=${{ env.RELEASE }}
tags: |
type=ref,event=branch
type=sha,enable=true,priority=100,prefix=,suffix=,format=short
type=match,enable=${{ env.RELEASE }},pattern=v\d+,group=0
type=match,enable=${{ env.RELEASE }},pattern=v\d+.\d+,group=0
type=match,enable=${{ env.RELEASE }},pattern=v\d+.\d+.\d+,group=0
- name: Publish images
uses: docker/build-push-action@v6
with:
context: ./src/GZCTF
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: ${{ env.RELEASE == 'true' && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
push: true
- name: Prune old packages
uses: vlaurin/[email protected]
with:
dry-run: false
token: ${{ secrets.GITHUB_TOKEN }}
container: ${{ github.event.repository.name }}/gzctf
keep-tags-regexes: ^v\d+\.\d+\.\d+$
prune-tags-regexes: ^[0-9a-f]{6,40}
keep-tags: |
latest
main
develop
keep-last: 20
prune-untagged: false