Release #629
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 | |
| on: | |
| workflow_run: | |
| workflows: ["Test"] | |
| branches: | |
| - main | |
| types: | |
| - completed | |
| permissions: | |
| contents: write | |
| jobs: | |
| goreleaser: | |
| if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Generate version tag | |
| id: version | |
| run: | | |
| # Get commit count as version number | |
| COUNT=$(git rev-list --count HEAD) | |
| SHORT_SHA=$(git rev-parse --short=6 HEAD) | |
| # Convert 6-char hex SHA to octal, prefixed with 9 to ensure valid semver | |
| SHA_OCTAL=$(printf '%o' "0x${SHORT_SHA}") | |
| VERSION="0.${COUNT}.9${SHA_OCTAL}" | |
| TAG="v${VERSION}" | |
| echo "version=${VERSION}" >> $GITHUB_OUTPUT | |
| echo "tag=${TAG}" >> $GITHUB_OUTPUT | |
| echo "sha=${SHORT_SHA}" >> $GITHUB_OUTPUT | |
| # Create and push tag | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git tag -a "${TAG}" -m "Release ${TAG} (${SHORT_SHA})" | |
| git push origin "${TAG}" | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.24' | |
| cache: true | |
| - name: Set up pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| cache: 'pnpm' | |
| cache-dependency-path: ui/pnpm-lock.yaml | |
| - name: Build UI | |
| env: | |
| # Drop JS source maps from release binaries (~6MB compressed) since | |
| # they're only useful with devtools open. Dev builds keep them. | |
| NO_SOURCEMAPS: '1' | |
| run: | | |
| cd ui | |
| pnpm install --frozen-lockfile | |
| pnpm run build | |
| - name: Build templates | |
| run: | | |
| for dir in templates/*/; do | |
| name=$(basename "$dir") | |
| echo "Creating $name.tar.gz..." | |
| tar -czf "templates/$name.tar.gz" -C "templates/$name" --exclude='.DS_Store' . | |
| done | |
| - name: Run GoReleaser | |
| uses: goreleaser/goreleaser-action@v6 | |
| with: | |
| distribution: goreleaser | |
| version: "~> v2" | |
| args: release --clean | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }} | |
| - name: Resolve headless-shell stable version | |
| id: headless | |
| run: | | |
| VERSION=$(python3 scripts/extract-headless-shell.py --resolve-version) | |
| TAG="headless-shell/v${VERSION}" | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "tag=$TAG" >> $GITHUB_OUTPUT | |
| # Check if this version is already released | |
| if gh release view "$TAG" >/dev/null 2>&1; then | |
| echo "skip=true" >> $GITHUB_OUTPUT | |
| echo "headless-shell $VERSION already released" | |
| else | |
| echo "skip=false" >> $GITHUB_OUTPUT | |
| echo "headless-shell $VERSION is new, will release" | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract and release headless-shell | |
| if: steps.headless.outputs.skip != 'true' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| python3 scripts/extract-headless-shell.py dist/headless-shell | |
| gh release create "${{ steps.headless.outputs.tag }}" \ | |
| --title "headless-shell ${{ steps.headless.outputs.version }}" \ | |
| --notes "Chromium headless-shell ${{ steps.headless.outputs.version }} extracted from chromedp/headless-shell:stable" \ | |
| dist/headless-shell/headless-shell-linux-*.tar.gz \ | |
| dist/headless-shell/headless-shell-version.txt |