name: Publish
permissions:
id-token: write
contents: write
on:
push:
branches:
- main
paths:
- version.txt
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Read version info
run: |
echo "GO_VERSION=$(cat go.version)" >> $GITHUB_ENV
echo "ESBUILD_VERSION=$(cat version.txt)" >> $GITHUB_ENV
- name: Try to create the "v${{ env.ESBUILD_VERSION }}" tag
run: |
git fetch --tags
git tag "v$ESBUILD_VERSION"
- name: Extract the release notes
run: |
CHANGELOG=$(awk -v "ver=$ESBUILD_VERSION" '/^## / { if (p) { exit }; if ($2 == ver) { p=1; next} } p' CHANGELOG.md)
echo "CHANGELOG<<EOF" >> $GITHUB_ENV
echo "$CHANGELOG" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Release notes must not be empty
run: |
test -n "$CHANGELOG"
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: 24
- name: Build for all platforms
run: |
make platform-all
- name: Reject uncommitted/untracked changes
run: |
git status --porcelain
test -z "$(git status --porcelain)"
- name: Install npm
run: |
npm install -g npm@11.5.1
- name: Publish packages
run: |
make publish-all
- name: Push the tag to GitHub
run: |
git push origin tag "v$ESBUILD_VERSION"
- name: Create a GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.ESBUILD_VERSION }}
release_name: v${{ env.ESBUILD_VERSION }}
body: ${{ env.CHANGELOG }}
draft: false
prerelease: false