Skip to content
Open
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
47 changes: 33 additions & 14 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ on:
permissions:
contents: write
pull-requests: write
id-token: write

name: Release Please

Expand All @@ -32,7 +33,7 @@ jobs:
steps:
- id: release
name: Release Please
uses: googleapis/release-please-action@v4
uses: googleapis/release-please-action@5c625bfb5d1ff62eadeeb3772007f7f66fdcf071 # v4

with:
release-type: node
Expand All @@ -44,11 +45,11 @@ jobs:

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

- if: ${{ steps.release.outputs.release_created }}
name: Setup Node for Dependency Installation
uses: actions/setup-node@v3
uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3
with:
node-version: 20
cache: npm
Expand All @@ -57,17 +58,35 @@ jobs:
name: Install Dependencies
run: npm ci

# Now configure node with the registry used for publishing
- if: ${{ steps.release.outputs.release_created }}
name: Setup Node for Publishing
uses: actions/setup-node@v3
- name: Authenticate to Google Cloud for OSS Exit Gate
if: ${{ steps.release.outputs.release_created }}
id: auth
uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3
with:
node-version: 20
registry-url: "https://wombat-dressing-room.appspot.com/"
token_format: 'access_token'
workload_identity_provider: 'projects/305452601764/locations/global/workloadIdentityPools/builders/providers/github'

- if: ${{ steps.release.outputs.release_created }}
name: Publish
# npm publish will trigger the build via the prepack hook
run: npm publish
- name: Set up Cloud SDK
if: ${{ steps.release.outputs.release_created }}
uses: google-github-actions/setup-gcloud@aa5489c8933f4cc7a4f7d45035b3b1440c9c10db # v3

- name: Stage to Artifact Registry and trigger OSS Exit Gate
if: ${{ steps.release.outputs.release_created }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_WOMBAT_TOKEN }}
ACCESS_TOKEN: ${{ steps.auth.outputs.access_token }}
RUN_ID: ${{ github.run_id }}
RUN_ATTEMPT: ${{ github.run_attempt }}
run: |
cat << 'NPMRC' > "$HOME/.npmrc"
registry=https://us-npm.pkg.dev/oss-exit-gate-prod/js-api-loader--npm/
//us-npm.pkg.dev/oss-exit-gate-prod/js-api-loader--npm/:always-auth=true
//us-npm.pkg.dev/oss-exit-gate-prod/js-api-loader--npm/:_authToken=${ACCESS_TOKEN}
NPMRC
trap 'rm -f "$HOME/.npmrc"' EXIT
npm publish --access public --registry="https://us-npm.pkg.dev/oss-exit-gate-prod/js-api-loader--npm/"
cat << 'MANIFEST' > manifest.json
{
"publish_all": true
}
MANIFEST
gcloud storage cp manifest.json "gs://oss-exit-gate-prod-projects-bucket/js-api-loader/npm/manifests/manifest-${RUN_ID}-${RUN_ATTEMPT}.json"
Loading