Skip to content

Commit 9d87791

Browse files
committed
Refactor to use composite action to initialize
1 parent 8d12d3d commit 9d87791

File tree

2 files changed

+31
-21
lines changed

2 files changed

+31
-21
lines changed

.github/util/initialize/action.yml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,48 @@ runs:
1717
with:
1818
node-version: "${{ inputs.node-version }}"
1919

20+
# See: https://github.com/dart-lang/sdk/issues/52266
21+
- run: Invoke-WebRequest https://pub.dev
22+
if: runner.os == 'Windows'
23+
shell: pwsh
24+
25+
# See: https://github.com/orgs/community/discussions/131594
26+
# The composite action requires an explict shell, but bash is not available on windows-arm64 runner.
27+
# For the following commands conditionally use bash or pwsh based on the runner.os:
2028
- run: dart pub get
29+
if: runner.os != 'Windows'
2130
shell: bash
2231

32+
- run: dart pub get
33+
if: runner.os == 'Windows'
34+
shell: pwsh
35+
2336
- run: npm install
37+
if: runner.os != 'Windows'
2438
shell: bash
2539

40+
- run: npm install
41+
if: runner.os == 'Windows'
42+
shell: pwsh
43+
2644
- uses: bufbuild/[email protected]
2745
with: {github_token: "${{ inputs.github-token }}"}
2846

2947
- name: Check out the language repo
48+
if: github.event_name == 'pull_request'
3049
uses: sass/clone-linked-repo@v1
3150
with: {repo: sass/sass, path: build/language}
3251

3352
- name: Generate Dart from protobuf
53+
if: runner.os != 'Windows'
3454
run: dart run grinder protobuf
35-
env: {UPDATE_SASS_SASS_REPO: false}
55+
env:
56+
UPDATE_SASS_SASS_REPO: ${{ github.event_name == 'pull_request' && 'false' || 'true' }}
3657
shell: bash
58+
59+
- name: Generate Dart from protobuf
60+
if: runner.os == 'Windows'
61+
run: dart run grinder protobuf
62+
env:
63+
UPDATE_SASS_SASS_REPO: ${{ github.event_name == 'pull_request' && 'false' || 'true' }}
64+
shell: pwsh

.github/workflows/build-windows.yml

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,8 @@ jobs:
2424
steps:
2525
- uses: actions/checkout@v4
2626

27-
# See: https://github.com/orgs/community/discussions/131594
28-
# The composite action requires bash which is not available on windows-arm64 runner.
29-
# - uses: ./.github/util/initialize
30-
# with: {github-token: "${{ github.token }}"}
31-
32-
- uses: dart-lang/setup-dart@v1
33-
34-
- uses: bufbuild/[email protected]
35-
with: {github_token: "${{ github.token }}"}
36-
37-
# See: https://github.com/dart-lang/sdk/issues/52266
38-
- name: Setup Root CA
39-
shell: pwsh
40-
run: Invoke-WebRequest https://pub.dev
41-
42-
- name: Install Dependencies
43-
run: dart pub get
44-
45-
- name: Compile Protobuf
46-
run: dart run grinder protobuf
27+
- uses: ./.github/util/initialize
28+
with: {github-token: "${{ github.token }}"}
4729

4830
- name: Build
4931
run: dart run grinder pkg-standalone-windows-${{ matrix.arch }}

0 commit comments

Comments
 (0)