Skip to content

Fix npm provenance validation during publish (#3692) #480

Fix npm provenance validation during publish (#3692)

Fix npm provenance validation during publish (#3692) #480

Workflow file for this run

name: Deploy
on:
push:
branches:
- 2023-04
- 2023-07
- 2023-10
- 2024-01
- 2024-04
- 2024-07
- 2024-10
- 20[0-9][0-9]-[01][1470]
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
changesets:
name: Deploy
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # Required for OIDC
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.SHOPIFY_GH_ACCESS_TOKEN }}
- uses: ./.github/workflows/actions/prepare
- name: Update npm to latest
run: npm install -g npm@latest
- id: changesets
name: Create release Pull Request or publish to NPM
uses: changesets/action@e0145edc7d9d8679003495b11f87bd8ef63c0cba # v1.5.3
with:
title: Version Packages (${{ github.ref_name }})
publish: yarn run deploy --tag ${{ github.ref_name }}
env:
NPM_TOKEN: '' # Forces OIDC authentication
GITHUB_TOKEN: ${{ secrets.SHOPIFY_GH_ACCESS_TOKEN }}
# Known to fail in OIDC (https://github.com/npm/cli/issues/8547).
# Workaround is to manually ask #help-eng-infrastructure to update `latest` tag.
- name: Set 'latest' NPM dist tag
if: steps.changesets.outputs.published == 'true' && github.ref_name == vars.LATEST_STABLE_VERSION
env:
PUBLISHED_PACKAGES: ${{ steps.changesets.outputs.publishedPackages }}
run: |
for pkg in $(echo "$PUBLISHED_PACKAGES" | jq -r '.[] | @base64'); do
_jq() {
echo ${pkg} | base64 --decode | jq -r ${1}
}
npm dist-tag add $(_jq '.name')@$(_jq '.version') latest
done