Skip to content

Compiler release

Compiler release #139

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: write
outputs:
COMPILER_VERSION_NUMBER: ${{ env.COMPILER_VERSION_NUMBER }}
env:
FORCE_COLOR: '1'
NODE_VERSION: '22.x'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
with:
submodules: recursive
- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # 4.4.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 ${{ secrets.GITHUB_TOKEN }}' \
https://api.github.com/repos/google/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
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
secrets:
NPM_PUBLISH_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_AUTH_TOKEN }}