-
Notifications
You must be signed in to change notification settings - Fork 121
Release via GitHub actions with changesets and provenance #883
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9de5438
Add github snapit and npm release workflows
juanpprieto 4935991
Clean up deploy script
juanpprieto 6b88bd0
Add changesets/cli dependency
juanpprieto 2fe3765
Update gitignore to allow changeset config
juanpprieto 2ce6ef5
Fix typos on README
juanpprieto 3ab6c03
Add basde changesets config
juanpprieto 80a8cdf
Remove npm publish from shipit workflow
juanpprieto 4156389
Update changeset config to point to master branch :(
juanpprieto 5cfd208
Revert back to main branch
juanpprieto 8dca04f
Merge branch 'main' into release-via-github-actions
juanpprieto File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "$schema": "https://unpkg.com/@changesets/[email protected]/schema.json", | ||
| "changelog": false, | ||
| "commit": false, | ||
| "fixed": [], | ||
| "linked": [], | ||
| "access": "restricted", | ||
| "baseBranch": "main", | ||
| "updateInternalDependencies": "patch", | ||
| "ignore": [] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| name: Release new NPM version | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [closed] | ||
| branches: | ||
| - main | ||
|
|
||
| concurrency: | ||
| group: changeset-${{ github.head_ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| npm: | ||
| name: Changeset release | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write # to be able to publish a GitHub release | ||
| pull-requests: write # to be able to comment on released pull requests | ||
| id-token: write # to enable use of OIDC for npm provenance | ||
| steps: | ||
| - name: Checkout the repo | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 1 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 16.16 | ||
| cache: 'yarn' | ||
| cache-dependency-path: '**/yarn.lock' | ||
|
|
||
| - name: Install dependencies | ||
| run: yarn install --no-progress --ignore-engines | ||
|
|
||
| - name: Check for changesets | ||
| id: check_changesets | ||
| run: | | ||
| if [ -z "$(ls -A .changeset)" ]; then | ||
| echo "No changesets found. Exiting." | ||
| echo "changesets_found=false" >> $GITHUB_ENV | ||
| exit 0 | ||
| else | ||
| echo "changesets_found=true" >> $GITHUB_ENV | ||
| fi | ||
|
|
||
| - name: Update package version and remove changesets | ||
| if: env.changesets_found == 'true' | ||
| run: npx changeset version | ||
|
|
||
| - name: Commit and push changes | ||
| if: env.changesets_found == 'true' | ||
| run: | | ||
| git config --global user.name 'github-actions[bot]' | ||
| git config --global user.email 'github-actions[bot]@users.noreply.github.com' | ||
| git add package.json .changeset | ||
| git commit -m "Update package version & delete changesets" | ||
| git push | ||
|
|
||
| - name: Publish to NPM | ||
| if: env.changesets_found == 'true' | ||
| id: changesets | ||
| uses: changesets/action@v1 | ||
| with: | ||
| publish: npx changeset publish | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
| NPM_CONFIG_PROVENANCE: true | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| name: Snapit with npm provenance | ||
|
|
||
| on: | ||
| issue_comment: | ||
| types: | ||
| - created | ||
|
|
||
| jobs: | ||
| snapit: | ||
| name: Snapit | ||
| if: ${{ github.event.issue.pull_request && github.event.comment.body == '/snapit' }} | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| id-token: write | ||
| steps: | ||
| - name: Checkout current branch | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Force snapshot | ||
| run: | | ||
| printf -- "---\n'@shopify/buy-button-js': patch\n" > snapshot.txt | ||
| - name: Create snapshot version | ||
| uses: Shopify/snapit@0c0d2dd62c9b0c94b7d03e1f54e72f18548e7752 # pin to a specific commit | ||
| with: | ||
| github_comment_included_packages: '@shopify/buy-button-js' | ||
| build_script: 'yarn build' | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
| NPM_CONFIG_PROVENANCE: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,6 @@ _site | |
| .sass-cache | ||
| .jekyll-metadata | ||
| /test/build | ||
| config.json | ||
| ./config.json | ||
| /.vscode | ||
| .DS_Store | ||
| .DS_Store | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,8 @@ | |
| "repository": "[email protected]:Shopify/buy-button-js.git", | ||
| "publishConfig": { | ||
| "access": "public", | ||
| "@shopify:registry": "https://registry.npmjs.org/" | ||
| "@shopify:registry": "https://registry.npmjs.org/", | ||
| "provenance": true | ||
| }, | ||
| "scripts": { | ||
| "start": "rm -rf tmp && mkdir tmp && yarn run src:watch & yarn run styles:watch & yarn run serve", | ||
|
|
@@ -68,6 +69,7 @@ | |
| "@babel/plugin-transform-spread": "7.2.2", | ||
| "@babel/plugin-transform-template-literals": "7.4.4", | ||
| "@babel/plugin-transform-typeof-symbol": "7.2.0", | ||
| "@changesets/cli": "^2.28.1", | ||
| "@shopify/js-uploader": "https://github.com/Shopify/js-uploader.git", | ||
| "aws-sdk": "2.6.8", | ||
| "babelify": "10.0.0", | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.