Skip to content
This repository was archived by the owner on Sep 19, 2025. It is now read-only.

Commit cc25f34

Browse files
Make build workflow reusable and update release workflow to automatically build
1 parent 2f73a43 commit cc25f34

File tree

2 files changed

+29
-20
lines changed

2 files changed

+29
-20
lines changed

.github/workflows/build.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ on:
44
push:
55
branches: [ master ]
66
workflow_dispatch: {}
7+
workflow_call:
8+
inputs:
9+
release-tag:
10+
required: true
11+
type: string
712
pull_request:
813
branches: [ master ]
914
schedule:
@@ -19,6 +24,9 @@ jobs:
1924
COMPILER_NIGHTLY: ${{ github.event_name == 'schedule' }}
2025
FORCE_COLOR: '1'
2126
steps:
27+
- name: Switch Commit
28+
run: git fetch --tags && git checkout --recurse-submodules ${{ inputs.release-tag }}
29+
if: ${{ inputs.release-tag != '' }}
2230
- name: Setup Java
2331
uses: actions/setup-java@v4
2432
with:
@@ -91,6 +99,9 @@ jobs:
9199
NODE_VERSION: '20.x'
92100
FORCE_COLOR: '1'
93101
steps:
102+
- name: Switch Commit
103+
run: git fetch --tags && git checkout --recurse-submodules ${{ inputs.release-tag }}
104+
if: ${{ inputs.release-tag != '' }}
94105
- name: Setup Java
95106
uses: actions/setup-java@v4
96107
with:
@@ -167,6 +178,9 @@ jobs:
167178
NODE_VERSION: '20.x'
168179
FORCE_COLOR: '1'
169180
steps:
181+
- name: Switch Commit
182+
run: git fetch --tags && git checkout --recurse-submodules ${{ inputs.release-tag }}
183+
if: ${{ inputs.release-tag != '' }}
170184
- name: Setup Java
171185
uses: actions/setup-java@v4
172186
with:
@@ -241,6 +255,9 @@ jobs:
241255
NODE_VERSION: '22.x'
242256
FORCE_COLOR: '1'
243257
steps:
258+
- name: Switch Commit
259+
run: git fetch --tags && git checkout --recurse-submodules ${{ inputs.release-tag }}
260+
if: ${{ inputs.release-tag != '' }}
244261
- name: Setup Java
245262
uses: actions/setup-java@v4
246263
with:
@@ -312,6 +329,9 @@ jobs:
312329
NODE_VERSION: '22.x'
313330
FORCE_COLOR: '1'
314331
steps:
332+
- name: Switch Commit
333+
run: git fetch --tags && git checkout --recurse-submodules ${{ inputs.release-tag }}
334+
if: ${{ inputs.release-tag != '' }}
315335
- name: Setup Java
316336
uses: actions/setup-java@v4
317337
with:
@@ -390,6 +410,9 @@ jobs:
390410
- build-macos
391411
- build-windows
392412
steps:
413+
- name: Switch Commit
414+
run: git fetch --tags && git checkout --recurse-submodules ${{ inputs.release-tag }}
415+
if: ${{ inputs.release-tag != '' }}
393416
- uses: actions/checkout@v4
394417
- name: Use Node.js ${{ env.NODE_VERSION }}
395418
uses: actions/setup-node@v4

.github/workflows/release.yml

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,6 @@ jobs:
2222
uses: actions/setup-node@v4
2323
with:
2424
node-version: ${{ env.NODE_VERSION }}
25-
- name: Setup Java
26-
uses: actions/setup-java@v4
27-
with:
28-
distribution: adopt-hotspot
29-
java-version: 21
30-
java-package: jdk
31-
architecture: x64
32-
- name: Setup Bazelisk
33-
uses: bazel-contrib/[email protected]
34-
with:
35-
# Avoid downloading Bazel every time.
36-
bazelisk-cache: true
37-
# Store build cache per workflow.
38-
disk-cache: ${{ github.workflow }}
39-
# Share repository cache between workflows.
40-
repository-cache: true
4125
- uses: actions/checkout@v4
4226
with:
4327
submodules: recursive
@@ -46,10 +30,6 @@ jobs:
4630
run: |
4731
git fetch --tags https://github.com/google/closure-compiler.git
4832
git checkout v${{ github.event.inputs.COMPILER_VERSION_NUMBER }}
49-
- name: Install packages
50-
run: yarn install --colors=always
51-
- name: Build jar
52-
run: ./build-scripts/build-compiler.js
5333
- name: Create release commit and tag
5434
run: |
5535
git config --global user.email "[email protected]"
@@ -66,3 +46,9 @@ jobs:
6646
-H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' \
6747
https://api.github.com/repos/google/closure-compiler-npm/releases \
6848
-d '{"tag_name":"v${{ github.event.inputs.COMPILER_VERSION_NUMBER }}.0.0","name":"${{ github.event.inputs.COMPILER_VERSION_NUMBER }}.0.0","body":"Closure-compiler ${{ github.event.inputs.COMPILER_VERSION_NUMBER }} release","draft":false,"prerelease":false,"generate_release_notes":true}'
49+
50+
call-build-workflow:
51+
needs: create-release
52+
uses: ./.github/workflows/build.yml
53+
with:
54+
release-tag: v${{ github.event.inputs.COMPILER_VERSION_NUMBER }}.0.0

0 commit comments

Comments
 (0)