Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: move publish into its own workflow #216

Merged
merged 2 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ on:
pull_request:
branches:
- main
workflow_call:

jobs:
lint:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753
with:
go-version: '^1.13.1'
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- name: Install addlicense
run: go install github.com/google/addlicense@latest
- name: Check license header
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# A workflow that publishes the library to CocoaPods
name: Publish

on:
workflow_call: # called when release-please steps.release.outputs.release_created
workflow_dispatch: # manually trigger if previous runs failed

concurrency:
group: publishing
cancel-in-progress: true

jobs:
build-and-test:
uses: ./.github/workflows/ci.yml

publish:
runs-on: ubuntu-latest
needs: build-and-test
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node for Dependency Installation
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm

- name: Install Dependencies
run: npm install

# Now configure node with the registry used for publishing
- name: Setup Node for Publishing
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: "https://wombat-dressing-room.appspot.com/"

- name: Publish
# npm publish will trigger the build via the prepack hook
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_WOMBOT_TOKEN }}
33 changes: 7 additions & 26 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@ permissions:
name: Release Please

jobs:
build-and-test:
uses: ./.github/workflows/ci.yml

release-please:
runs-on: ubuntu-latest
needs: build-and-test
steps:
- id: release
name: Release Please
Expand All @@ -47,32 +51,9 @@ jobs:
# Note the "if" statement on all commands to make sure that publishing
# only happens when a release is cut.

- if: ${{ steps.release.outputs.release_created }}
name: Checkout
- name: Checkout
uses: actions/checkout@v4

- if: ${{ steps.release.outputs.release_created }}
name: Setup Node for Dependency Installation
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm

- if: ${{ steps.release.outputs.release_created }}
name: Install Dependencies
run: npm install

# Now configure node with the registry used for publishing
- if: ${{ steps.release.outputs.release_created }}
name: Setup Node for Publishing
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: "https://wombat-dressing-room.appspot.com/"

- if: ${{ steps.release.outputs.release_created }}
name: Publish
# npm publish will trigger the build via the prepack hook
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_WOMBOT_TOKEN }}
name: Start publish
uses: ./.github/workflows/publish.yml
Loading