Skip to content

Compiler release

Compiler release #10

Workflow file for this run

name: Compiler release
on:
workflow_dispatch:
inputs:
COMPILER_VERSION_NUMBER:
description: 'Compiler version to base release from'
required: false
type: string
schedule:
# Daily at 12pm UTC
- cron: '0 12 * * *'
jobs:
create-release:
name: Create release
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
COMPILER_VERSION_NUMBER: ${{ env.COMPILER_VERSION_NUMBER }}
env:
FORCE_COLOR: '1'
NODE_VERSION: '22.x'
steps:
- uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 # 2.1.4
id: app-token
with:
app-id: '2007599' # Closure-Compiler Create Release app
private-key: ${{ secrets.COMPILER_RELEASE_APP_PRIVATE_KEY }}
permission-contents: write
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0
with:
submodules: recursive
token: ${{ steps.app-token.outputs.token }}
- name: Setup Node.js
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # 5.0.0
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn
- name: Install packages
run: YARN_ENABLE_COLORS=true yarn install
- name: Fetch compiler submodule tags
working-directory: compiler
run: git fetch --tags https://github.com/google/closure-compiler.git
- name: Find compiler submodule newer release tag
if: ${{ github.event.inputs.COMPILER_VERSION_NUMBER == '' }}
run: |
echo "COMPILER_VERSION_NUMBER=$(./build-scripts/checkout-newer-version-tag.js)" >> "$GITHUB_ENV"
echo "COMPILER_VERSION_NUMBER='$COMPILER_VERSION_NUMBER'" >> "$GITHUB_OUTPUT"
- name: Set compiler version to provided value
if: ${{ github.event.inputs.COMPILER_VERSION_NUMBER != '' }}
run: |
echo "COMPILER_VERSION_NUMBER=${{ github.event.inputs.COMPILER_VERSION_NUMBER }}" >> "$GITHUB_ENV"
- name: Set compiler submodule to provided release branch
if: ${{ env.COMPILER_VERSION_NUMBER != '' }}
working-directory: compiler
run: git checkout v${{ env.COMPILER_VERSION_NUMBER }}
- name: Create release commit and tag
if: ${{ env.COMPILER_VERSION_NUMBER != '' }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "Github Bot"
git add compiler
./build-scripts/version-packages.js --new-version ${{ env.COMPILER_VERSION_NUMBER }}.0.0
git push origin master
git push origin v${{ env.COMPILER_VERSION_NUMBER }}.0.0
- name: Create GitHub Release
if: ${{ env.COMPILER_VERSION_NUMBER != '' }}
run: |
curl \
-X POST \
-H 'Accept: application/vnd.github+json' \
-H 'Authorization: token ${{ steps.app-token.outputs.token }}' \
https://api.github.com/repos/chadkillingsworth/closure-compiler-npm/releases \
-d '{"tag_name":"v${{ env.COMPILER_VERSION_NUMBER }}.0.0","name":"${{ env.COMPILER_VERSION_NUMBER }}.0.0","body":"Closure-compiler ${{ env.COMPILER_VERSION_NUMBER }} release","draft":false,"prerelease":false,"generate_release_notes":true}'
build:
needs: create-release
permissions:
contents: write
id-token: write # Required for OIDC
if: ${{ needs.create-release.outputs.COMPILER_VERSION_NUMBER != '' }}
uses: ./.github/workflows/build.yml
with:
release-tag: v${{ needs.create-release.outputs.COMPILER_VERSION_NUMBER }}.0.0