chore: version packages (#678) #21
Workflow file for this run
This file contains hidden or 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: Docker | |
| on: | |
| push: | |
| tags: | |
| - 'perstack@*' | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Tag to build (e.g. perstack@0.0.93). Uses HEAD if empty.' | |
| required: false | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: false | |
| permissions: | |
| contents: read | |
| jobs: | |
| docker: | |
| name: Build & Push | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Extract version | |
| id: version | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ inputs.tag }}" ]; then | |
| TAG="${{ inputs.tag }}" | |
| else | |
| TAG="${GITHUB_REF#refs/tags/}" | |
| fi | |
| VERSION="${TAG#perstack@}" | |
| MAJOR_MINOR="${VERSION%.*}" | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| echo "major_minor=$MAJOR_MINOR" >> "$GITHUB_OUTPUT" | |
| echo "tag=$TAG" >> "$GITHUB_OUTPUT" | |
| # Only tag as latest on push events (actual releases), not manual dispatches | |
| if [ "${{ github.event_name }}" = "push" ]; then | |
| echo "is_release=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "is_release=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ steps.version.outputs.tag }} | |
| - name: Setup QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Setup Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: docker/Dockerfile | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: | | |
| perstack/perstack:${{ steps.version.outputs.version }} | |
| perstack/perstack:${{ steps.version.outputs.major_minor }} | |
| ${{ steps.version.outputs.is_release == 'true' && 'perstack/perstack:latest' || '' }} | |
| perstack/perstack:sha-${{ github.sha }} | |
| sbom: true | |
| provenance: mode=max | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |