Skip to content

Commit

Permalink
feat(snapshot): configure snapshot releases (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
bahag-buttf committed Dec 13, 2023
1 parent e635f8b commit 4ae31bb
Show file tree
Hide file tree
Showing 5 changed files with 318 additions and 191 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
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: Version snapshot release
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
run: yarn version-packages-snapshot

- name: Publish release snapshot
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NODE_AUTH_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
Empty file removed .npmrc
Empty file.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
"lint": "turbo lint",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"version-packages": "changeset version",
"version-packages-snapshot": "changeset version --snapshot",
"changeset": "changeset",
"release": "turbo run build && changeset publish"
"release": "yarn build && changeset publish",
"release-snapshot": "yarn build && changeset publish --no-git-tag --snapshot"
},
"devDependencies": {
"prettier": "^3.1.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@repo/ui",
"name": "@bahag-buttf/ui",
"version": "0.0.0",
"private": true,
"exports": {
Expand All @@ -11,8 +11,8 @@
"generate:component": "turbo gen react-component"
},
"devDependencies": {
"@bahag-buttf/eslint-config": "*",
"@bahag-buttf/typescript-config": "*",
"@bahag-buttf/eslint-config": "^0.0.7",
"@bahag-buttf/typescript-config": "^0.0.3",
"@turbo/gen": "^1.10.12",
"@types/node": "^20.5.2",
"@types/eslint": "^8.44.7",
Expand Down
Loading

0 comments on commit 4ae31bb

Please sign in to comment.