Skip to content

Commit bc426ac

Browse files
authored
chore: move publish into its own workflow (#216)
2 parents c03b3d9 + 262ad6c commit bc426ac

File tree

4 files changed

+67
-30
lines changed

4 files changed

+67
-30
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ on:
2020
pull_request:
2121
branches:
2222
- main
23+
workflow_call:
2324

2425
jobs:
2526
lint:
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@ jobs:
2424
runs-on: ubuntu-latest
2525
timeout-minutes: 30
2626
steps:
27-
- uses: actions/checkout@v3
28-
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753
29-
with:
30-
go-version: '^1.13.1'
27+
- uses: actions/checkout@v4
28+
- uses: actions/setup-go@v5
3129
- name: Install addlicense
3230
run: go install github.com/google/addlicense@latest
3331
- name: Check license header

.github/workflows/publish.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Copyright 2024 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# A workflow that publishes the library to CocoaPods
16+
name: Publish
17+
18+
on:
19+
workflow_call: # called when release-please steps.release.outputs.release_created
20+
workflow_dispatch: # manually trigger if previous runs failed
21+
22+
concurrency:
23+
group: publishing
24+
cancel-in-progress: true
25+
26+
jobs:
27+
build-and-test:
28+
uses: ./.github/workflows/ci.yml
29+
30+
publish:
31+
runs-on: ubuntu-latest
32+
needs: build-and-test
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v4
36+
37+
- name: Setup Node for Dependency Installation
38+
uses: actions/setup-node@v4
39+
with:
40+
node-version: 20
41+
cache: npm
42+
43+
- name: Install Dependencies
44+
run: npm install
45+
46+
# Now configure node with the registry used for publishing
47+
- name: Setup Node for Publishing
48+
uses: actions/setup-node@v4
49+
with:
50+
node-version: 20
51+
registry-url: "https://wombat-dressing-room.appspot.com/"
52+
53+
- name: Publish
54+
# npm publish will trigger the build via the prepack hook
55+
run: npm publish
56+
env:
57+
NODE_AUTH_TOKEN: ${{ secrets.NPM_WOMBOT_TOKEN }}

.github/workflows/release-please.yml

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,12 @@ permissions:
3232
name: Release Please
3333

3434
jobs:
35+
build-and-test:
36+
uses: ./.github/workflows/ci.yml
37+
3538
release-please:
3639
runs-on: ubuntu-latest
40+
needs: build-and-test
3741
steps:
3842
- id: release
3943
name: Release Please
@@ -47,32 +51,9 @@ jobs:
4751
# Note the "if" statement on all commands to make sure that publishing
4852
# only happens when a release is cut.
4953

50-
- if: ${{ steps.release.outputs.release_created }}
51-
name: Checkout
54+
- name: Checkout
5255
uses: actions/checkout@v4
5356

5457
- if: ${{ steps.release.outputs.release_created }}
55-
name: Setup Node for Dependency Installation
56-
uses: actions/setup-node@v4
57-
with:
58-
node-version: 20
59-
cache: npm
60-
61-
- if: ${{ steps.release.outputs.release_created }}
62-
name: Install Dependencies
63-
run: npm install
64-
65-
# Now configure node with the registry used for publishing
66-
- if: ${{ steps.release.outputs.release_created }}
67-
name: Setup Node for Publishing
68-
uses: actions/setup-node@v4
69-
with:
70-
node-version: 20
71-
registry-url: "https://wombat-dressing-room.appspot.com/"
72-
73-
- if: ${{ steps.release.outputs.release_created }}
74-
name: Publish
75-
# npm publish will trigger the build via the prepack hook
76-
run: npm publish
77-
env:
78-
NODE_AUTH_TOKEN: ${{ secrets.NPM_WOMBOT_TOKEN }}
58+
name: Start publish
59+
uses: ./.github/workflows/publish.yml

0 commit comments

Comments
 (0)