Update QuickJS #124
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: Update QuickJS | |
| on: | |
| schedule: | |
| # Check daily at 06:00 UTC | |
| - cron: '0 6 * * *' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| update: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | |
| with: | |
| fetch-depth: 0 | |
| # A PAT is required for the tag push to trigger the release workflow. | |
| # Falls back to GITHUB_TOKEN (release workflow won't be triggered). | |
| token: ${{ secrets.PAT || github.token }} | |
| - name: Check for new upstream release | |
| id: check | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| CURRENT=$(grep 'Version = ' version.go | sed 's/.*"\(.*\)"/\1/') | |
| LATEST=$(gh release view --repo quickjs-ng/quickjs --json tagName --jq '.tagName') | |
| echo "current=$CURRENT" >> "$GITHUB_OUTPUT" | |
| echo "latest=$LATEST" >> "$GITHUB_OUTPUT" | |
| if [ "$CURRENT" = "$LATEST" ]; then | |
| echo "Already up to date ($CURRENT)" | |
| echo "updated=false" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "New version available: $CURRENT -> $LATEST" | |
| echo "updated=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Update QuickJS WASM | |
| if: steps.check.outputs.updated == 'true' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: ./update-quickjs.bash "${{ steps.check.outputs.latest }}" | |
| - name: Setup Go | |
| if: steps.check.outputs.updated == 'true' | |
| uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | |
| with: | |
| go-version: '1.26' | |
| - name: Run tests | |
| if: steps.check.outputs.updated == 'true' | |
| run: | | |
| go test -v | |
| cd ./wazero-quickjs && go test -v | |
| - name: Commit and tag | |
| if: steps.check.outputs.updated == 'true' | |
| run: | | |
| TAG="${{ steps.check.outputs.latest }}" | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add -A | |
| git commit -s -m "chore: update quickjs to ${TAG}" | |
| git tag "$TAG" | |
| git push origin HEAD "$TAG" |