Skip to content

Commit

Permalink
Add /release:next magic comment
Browse files Browse the repository at this point in the history
  • Loading branch information
12joan committed Dec 21, 2023
1 parent 617d04f commit 3dd81ff
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 1 deletion.
69 changes: 69 additions & 0 deletions .github/workflows/comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Define actions that run in response to comments on issues and PRs
# Based on https://github.com/ianstormtaylor/slate/blob/main/.github/workflows/comment.yml
#
# Allowed GitHub users: zbeyens, 12joan
#
# Supported comments:
# - /release:next (PR only) - Publish the branch to NPM with tag 'next'

name: Comment

on:
issue_comment:
types:
- created

jobs:
release_next:
permissions:
contents: read # to fetch code (actions/checkout)
pull-requests: write # to create or update comment (peter-evans/create-or-update-comment)

name: release:next
runs-on: ubuntu-latest
if: |
github.event.issue.pull_request &&
contains(['zbeyens', '12joan'], github.event.sender.login) &&
startsWith(github.event.comment.body, '/release:next')
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Checkout pull request
run: hub pr checkout ${{ github.event.issue.number }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Setup node
uses: actions/setup-node@v2
with:
node-version: 20.x
cache: yarn
registry-url: https://registry.npmjs.org
key: node20

- name: ♻️ Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: 📥 Monorepo install
uses: ./.github/actions/yarn-nm-install

- name: Publish to NPM
run: yarn release:next
env:
# See https://github.com/changesets/action/issues/147
HOME: ${{ github.workspace }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Create comment
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.issue.number }}
body: |
A new release has been made for this pull request.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
"typecheck": "yarn g:typecheck",
"typedoc": "npx typedoc --options scripts/typedoc.json",
"release": "yarn build && yarn changeset publish",
"release:next": "yarn build && yarn changeset publish --tag next",
"g:brl": "turbo --filter \"./packages/**\" brl --no-daemon",
"g:build": "turbo --filter \"./packages/**\" build --no-daemon",
"g:build:watch": "yarn build:watch",
"g:changeset": "changeset",
"g:clean": "yarn clean:turbo && turbo --filter \"./packages/**\" clean --no-daemon",
"g:lint": "turbo --filter \"./packages/**\" lint --no-daemon",
"g:lint:fix": "turbo lint:fix --no-daemon",
"g:release:next": "yarn yarn build && yarn changeset publish --tag next",
"g:test": "turbo --filter \"./packages/**\" test --no-daemon",
"g:test:watch": "turbo --filter \"./packages/**\" test:watch --no-daemon",
"g:test:cov": "yarn g:test --coverage",
Expand Down

0 comments on commit 3dd81ff

Please sign in to comment.