-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(snapshot): configure snapshot releases (#18)
- Loading branch information
1 parent
e635f8b
commit 0a1723d
Showing
5 changed files
with
335 additions
and
191 deletions.
There are no files selected for viewing
This file contains 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,88 @@ | ||
name: Snapshot | ||
|
||
on: | ||
issue_comment: | ||
types: | ||
- created | ||
|
||
jobs: | ||
snapshot: | ||
name: Snapshot Release | ||
if: | | ||
github.event.issue.pull_request && | ||
(startsWith(github.event.comment.body, '/snapit') || startsWith(github.event.comment.body, '/snapshot-release')) | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Enforce permission requirement | ||
uses: prince-chrismc/check-actor-permissions-action@v1 | ||
with: | ||
permission: write | ||
|
||
- name: Add initial reaction | ||
uses: peter-evans/create-or-update-comment@v2 | ||
with: | ||
comment-id: ${{ github.event.comment.id }} | ||
reactions: eyes | ||
|
||
- name: Checkout default branch | ||
uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.GH_TOKEN }} | ||
|
||
# issue_comment requires us to checkout the branch | ||
# https://github.com/actions/checkout/issues/331#issuecomment-1120113003 | ||
- name: Checkout pull request branch | ||
run: gh pr checkout ${{ github.event.issue.number }} | ||
env: | ||
GH_TOKEN: ${{ secrets.GH_TOKEN }} | ||
|
||
# # Because changeset entries are consumed and removed on the | ||
# # 'changeset-release/main' branch, we need to reset the files | ||
# # so the following 'changeset version --snapshot' command will | ||
# # regenerate the package version bumps with the snapshot releases | ||
# - name: Reset changeset entries on changeset-release/main branch | ||
# run: | | ||
# if [[ $(git branch --show-current) == 'changeset-release/main' ]]; then | ||
# git checkout origin/main -- .changeset | ||
# fi | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
registry-url: 'https://npm.pkg.github.com' | ||
|
||
- name: Install dependencies | ||
run: yarn | ||
|
||
- name: Creating .npmrc | ||
run: | | ||
cat << EOF > "$HOME/.npmrc" | ||
//npm.pkg.github.com/:_authToken=$NPM_TOKEN | ||
EOF | ||
env: | ||
NPM_TOKEN: ${{ secrets.GH_TOKEN }} | ||
|
||
- name: Creating .yarnrc | ||
run: | | ||
cat << EOF > "$HOME/.yarnrc" | ||
"//npm.pkg.github.com/:_authToken" "${{ secrets.GH_TOKEN }}" | ||
EOF | ||
env: | ||
GH_TOKEN: ${{ secrets.GH_TOKEN }} | ||
|
||
- name: Version snapshot release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | ||
run: yarn version-packages-snapshot | ||
|
||
- name: Release snapshot | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | ||
run: yarn release-snapshot | ||
|
||
- name: Add final reaction | ||
uses: peter-evans/create-or-update-comment@v2 | ||
with: | ||
comment-id: ${{ github.event.comment.id }} | ||
reactions: rocket |
This file contains 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,2 @@ | ||
//npm.pkg.github.com/:_authToken=TOKEN | ||
@bahag-buttf:registry=https://npm.pkg.github.com/ |
This file contains 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 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.