name: release on: push: tags: ['v*'] workflow_dispatch: inputs: version: description: Version with release notes, such as v0.1.0 required: true type: string permissions: contents: read concurrency: group: release-${{ github.ref }} cancel-in-progress: false jobs: prepare: runs-on: ubuntu-latest timeout-minutes: 5 outputs: version: ${{ steps.version.outputs.version }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Validate release version and notes id: version env: VERSION_INPUT: ${{ inputs.version }} shell: bash run: | if [[ "$GITHUB_EVENT_NAME" == push ]]; then version="$GITHUB_REF_NAME" else version="$VERSION_INPUT" fi if [[ ! "$version" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z]+([.-][0-9A-Za-z]+)*)?$ ]]; then echo 'Expected vMAJOR.MINOR.PATCH[-PRERELEASE]' >&2 exit 1 fi test -s "docs/releases/$version.md" echo "version=$version" >> "$GITHUB_OUTPUT" verify: needs: prepare uses: ./.github/workflows/test.yml build: needs: [prepare, verify] runs-on: ubuntu-latest timeout-minutes: 15 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 with: go-version: "1.26.x" check-latest: true cache: true - name: Build and verify archives env: RELEASE_VERSION: ${{ needs.prepare.outputs.version }} run: | bash scripts/release.sh "$RELEASE_VERSION" bash scripts/verify-release.sh "$RELEASE_VERSION" - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: ask53-release-${{ needs.prepare.outputs.version }} path: dist/${{ needs.prepare.outputs.version }}/ if-no-files-found: error retention-days: 14 draft: if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') needs: [prepare, build] runs-on: ubuntu-latest timeout-minutes: 5 permissions: contents: write actions: read steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: Download verified archives and create draft env: GH_TOKEN: ${{ github.token }} GH_REPO: ${{ github.repository }} RELEASE_VERSION: ${{ needs.prepare.outputs.version }} shell: bash run: | gh run download "$GITHUB_RUN_ID" --name "ask53-release-$RELEASE_VERSION" --dir "dist/$RELEASE_VERSION" (cd "dist/$RELEASE_VERSION" && sha256sum -c SHA256SUMS) flags=(--draft --verify-tag --title "Ask53 $RELEASE_VERSION" --notes-file "docs/releases/$RELEASE_VERSION.md") if [[ "$RELEASE_VERSION" == *-* ]]; then flags+=(--prerelease) fi gh release create "$RELEASE_VERSION" "${flags[@]}" "dist/$RELEASE_VERSION/"*.tar.gz "dist/$RELEASE_VERSION/SHA256SUMS"