Release E2E #4
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: Release E2E | |
| on: | |
| workflow_run: | |
| workflows: | |
| - Prerelease | |
| types: | |
| - completed | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| jobs: | |
| smoke: | |
| if: github.event.workflow_run.conclusion == 'success' | |
| runs-on: ubuntu-slim | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ github.event.workflow_run.head_sha }} | |
| - name: Determine prerelease tag | |
| id: tag | |
| run: | | |
| set -euo pipefail | |
| git fetch --tags --force | |
| tag="$(git tag --points-at "${{ github.event.workflow_run.head_sha }}" | grep -E '^v[0-9]+$' | head -n 1 || true)" | |
| if [[ -z "$tag" ]]; then | |
| echo "no prerelease tag found for ${{ github.event.workflow_run.head_sha }}" >&2 | |
| exit 1 | |
| fi | |
| echo "tag=$tag" >> "$GITHUB_OUTPUT" | |
| - name: Download prerelease Linux binary | |
| id: bin | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| GH_REPO: ${{ github.repository }} | |
| run: | | |
| set -euo pipefail | |
| case "$(uname -m)" in | |
| x86_64) arch=amd64 ;; | |
| aarch64) arch=arm64 ;; | |
| *) echo "unsupported arch: $(uname -m)" >&2; exit 1 ;; | |
| esac | |
| name="punch-linux-${arch}" | |
| mkdir -p dist | |
| gh release download "${{ steps.tag.outputs.tag }}" \ | |
| --pattern "$name" \ | |
| --dir dist | |
| chmod +x "dist/${name}" | |
| echo "path=dist/${name}" >> "$GITHUB_OUTPUT" | |
| - name: Run E2E smoke test | |
| env: | |
| PUNCH_BIN: ${{ steps.bin.outputs.path }} | |
| run: ./scripts/smoke-e2e.sh | |
| - name: Promote release to latest | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| GH_REPO: ${{ github.repository }} | |
| run: | | |
| set -euo pipefail | |
| gh release edit "${{ steps.tag.outputs.tag }}" \ | |
| --prerelease=false \ | |
| --latest |