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

ci: use OIDC to get the valid token #20

Merged
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
16 changes: 15 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Release
permissions:
id-token: write
contents: write

on:
Expand Down Expand Up @@ -44,21 +45,34 @@ jobs:
done
set -e

- name: Setup Google Auth 🔧
id: auth
# yamllint disable-line rule:line-length
# nosemgrep: yaml.github-actions.security.third-party-action-not-pinned-to-commit-sha.third-party-action-not-pinned-to-commit-sha
uses: google-github-actions/auth@v2
with:
# yamllint disable-line rule:line-length
workload_identity_provider: projects/306279023132/locations/global/workloadIdentityPools/github/providers/github
service_account: github-actions@chrome-web-store-api-435512.iam.gserviceaccount.com
token_format: access_token

- name: Upload to Google Web Store
env:
VERSION: ${{ github.event.release.tag_name }}
GOOGLE_CHROME_WEBSTORE_APP_ID: ${{ secrets.GOOGLE_CHROME_WEBSTORE_APP_ID }}
GOOGLE_CHROME_WEBSTORE_TOKEN: ${{ secrets.GOOGLE_CHROME_WEBSTORE_TOKEN }}
GOOGLE_CHROME_WEBSTORE_TOKEN: ${{ steps.auth.outputs.access_token }}
run: |
name="mergify-chrome-${VERSION}.zip"
curl \
-v \
--fail \
-H "Authorization: Bearer ${GOOGLE_CHROME_WEBSTORE_TOKEN}" \
-H "x-goog-api-version: 2" \
-X PUT \
-T "$name" \
"https://www.googleapis.com/upload/chromewebstore/v1.1/items/${GOOGLE_CHROME_WEBSTORE_APP_ID}"
curl -v \
--fail \
-H "Authorization: Bearer $GOOGLE_CHROME_WEBSTORE_TOKEN" \
-H "x-goog-api-version: 2" \
-H "Content-Length: 0" \
Expand Down