-
Notifications
You must be signed in to change notification settings - Fork 4
Setup workflows #43
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
base: master
Are you sure you want to change the base?
Setup workflows #43
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,47 @@ | ||||||||||||||||||||||||||||
| name: workflow for Master | ||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||
| push: | ||||||||||||||||||||||||||||
| branches: | ||||||||||||||||||||||||||||
| - "master" | ||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||
| build: | ||||||||||||||||||||||||||||
| runs-on: ubicloud-standard-2 | ||||||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||||||
| contents: read | ||||||||||||||||||||||||||||
| id-token: write | ||||||||||||||||||||||||||||
| packages: write | ||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||
| - name: Checkout repository | ||||||||||||||||||||||||||||
| uses: actions/checkout@v5 | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| - name: Setup Node.js | ||||||||||||||||||||||||||||
| uses: actions/setup-node@v5 | ||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||
| node-version: '20' | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| - id: 'auth-spotdraft-qa' | ||||||||||||||||||||||||||||
| name: 'Authenticate to Google Cloud' | ||||||||||||||||||||||||||||
| uses: 'google-github-actions/auth@v1.1.1' | ||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||
| token_format: 'access_token' | ||||||||||||||||||||||||||||
| workload_identity_provider: 'projects/400887723303/locations/global/workloadIdentityPools/github-actions-pool/providers/github-provider' | ||||||||||||||||||||||||||||
| service_account: 'github-actions@spotdraft-qa.iam.gserviceaccount.com' | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| - name: Set up gcloud CLI | ||||||||||||||||||||||||||||
| uses: google-github-actions/setup-gcloud@v3 | ||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||
| project_id: 'spotdraft-qa' | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| - name: Configure NPM to use Artifact Registry | ||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||
| TOKEN=$(gcloud auth print-access-token) | ||||||||||||||||||||||||||||
| rm -rf .npmrc | ||||||||||||||||||||||||||||
| echo -e "\n//asia-south1-npm.pkg.dev/spotdraft-qa/npm/:_authToken=\"$TOKEN\"" >> .npmrc | ||||||||||||||||||||||||||||
| echo "@spotdraft:registry=https://asia-south1-npm.pkg.dev/spotdraft-qa/npm/" >> .npmrc | ||||||||||||||||||||||||||||
|
Comment on lines
+35
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add Artifact Registry’s own guidance keeps an TOKEN=$(gcloud auth print-access-token)
rm -rf .npmrc
- echo -e "\n//asia-south1-npm.pkg.dev/spotdraft-qa/npm/:_authToken=\"$TOKEN\"" >> .npmrc
+ echo -e "\n//asia-south1-npm.pkg.dev/spotdraft-qa/npm/:always-auth=true" >> .npmrc
+ echo "//asia-south1-npm.pkg.dev/spotdraft-qa/npm/:_authToken=\"$TOKEN\"" >> .npmrc
echo "@spotdraft:registry=https://asia-south1-npm.pkg.dev/spotdraft-qa/npm/" >> .npmrc📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| - name: Install dependencies | ||||||||||||||||||||||||||||
| run: npm install | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| - name: Publish package | ||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||
| npm publish | ||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,47 @@ | ||||||||||||||||||
| name: workflow for PR | ||||||||||||||||||
| on: | ||||||||||||||||||
| pull_request: | ||||||||||||||||||
| types: [opened, synchronize, reopened] | ||||||||||||||||||
| branches: [master] | ||||||||||||||||||
| jobs: | ||||||||||||||||||
| build: | ||||||||||||||||||
| runs-on: ubicloud-standard-2 | ||||||||||||||||||
| permissions: | ||||||||||||||||||
| contents: read | ||||||||||||||||||
| id-token: write | ||||||||||||||||||
| packages: write | ||||||||||||||||||
| steps: | ||||||||||||||||||
| - name: Checkout repository | ||||||||||||||||||
| uses: actions/checkout@v5 | ||||||||||||||||||
|
|
||||||||||||||||||
| - name: Setup Node.js | ||||||||||||||||||
| uses: actions/setup-node@v5 | ||||||||||||||||||
| with: | ||||||||||||||||||
| node-version: '24' | ||||||||||||||||||
|
Comment on lines
+17
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PR workflow now sets
Suggested change
Finding type: |
||||||||||||||||||
|
|
||||||||||||||||||
| - id: 'auth-spotdraft-qa' | ||||||||||||||||||
| name: 'Authenticate to Google Cloud' | ||||||||||||||||||
| uses: 'google-github-actions/auth@v1.1.1' | ||||||||||||||||||
| with: | ||||||||||||||||||
| token_format: 'access_token' | ||||||||||||||||||
| workload_identity_provider: 'projects/400887723303/locations/global/workloadIdentityPools/github-actions-pool/providers/github-provider' | ||||||||||||||||||
| service_account: 'github-actions@spotdraft-qa.iam.gserviceaccount.com' | ||||||||||||||||||
|
|
||||||||||||||||||
| - name: Set up gcloud CLI | ||||||||||||||||||
| uses: google-github-actions/setup-gcloud@v3 | ||||||||||||||||||
| with: | ||||||||||||||||||
| project_id: 'spotdraft-qa' | ||||||||||||||||||
|
|
||||||||||||||||||
| - name: Configure NPM to use Artifact Registry | ||||||||||||||||||
| run: | | ||||||||||||||||||
| TOKEN=$(gcloud auth print-access-token) | ||||||||||||||||||
| rm -rf .npmrc | ||||||||||||||||||
| echo -e "\n//asia-south1-npm.pkg.dev/spotdraft-qa/npm/:_authToken=\"$TOKEN\"" >> .npmrc | ||||||||||||||||||
| echo "@spotdraft:registry=https://asia-south1-npm.pkg.dev/spotdraft-qa/npm/" >> .npmrc | ||||||||||||||||||
|
Comment on lines
+37
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix
- TOKEN=$(gcloud auth print-access-token)
- rm -rf .npmrc
- echo -e "\n//asia-south1-npm.pkg.dev/spotdraft-qa/npm/:_authToken=\"$TOKEN\"" >> .npmrc
- echo "@spotdraft:registry=https://asia-south1-npm.pkg.dev/spotdraft-qa/npm/" >> .npmrc
+ TOKEN="$(gcloud auth print-access-token)"
+ cat <<'EOF' > .npmrc
+//asia-south1-npm.pkg.dev/spotdraft-qa/npm/:_authToken=${TOKEN}
+@spotdraft:registry=https://asia-south1-npm.pkg.dev/spotdraft-qa/npm/
+EOF
🤖 Prompt for AI Agents |
||||||||||||||||||
|
|
||||||||||||||||||
| - name: Install dependencies | ||||||||||||||||||
| run: npm install | ||||||||||||||||||
|
|
||||||||||||||||||
| - name: Publish package | ||||||||||||||||||
| run: | | ||||||||||||||||||
| npm publish --dry-run | ||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,5 +1,5 @@ | ||||||||||||||||||||
| { | ||||||||||||||||||||
| "name": "liquidjs", | ||||||||||||||||||||
| "name": "@spotdraft/liquidjs", | ||||||||||||||||||||
| "version": "3.1.0", | ||||||||||||||||||||
| "description": "Liquid template engine by pure JavaScript: compatible to shopify, easy to extend.", | ||||||||||||||||||||
|
Comment on lines
1
to
4
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. renaming the package to
Suggested change
Finding type: |
||||||||||||||||||||
| "main": "index.js", | ||||||||||||||||||||
|
|
||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
echo -e "..._authToken="$TOKEN"" expands the freshly minted GCP access token inside the logged shell command, so the raw token is emitted in every workflow log (same lines exist in
pr.yaml); can we mask the token (e.g.echo "::add-mask::$TOKEN") or otherwise avoid printing the value when writing.npmrc?Finding type:
Basic Security Patterns