0.4.0 #49
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
name: snapshot release | |
on: | |
issue_comment: | |
types: [created] | |
jobs: | |
snapshot_release: | |
runs-on: ubuntu-latest | |
if: >- | |
github.event.issue.pull_request && | |
github.event.comment.body == ':snapshot_release' && | |
github.event.comment.author_association == 'OWNER' | |
steps: | |
- id: "get-branch" | |
run: echo ::set-output name=branch::$(gh pr view $PR_NO --repo $REPO --json headRefName --jq '.headRefName') | |
env: | |
REPO: ${{ github.repository }} | |
PR_NO: ${{ github.event.issue.number }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ steps.get-branch.outputs.branch }} | |
- uses: ./.github/actions/setup-node | |
- uses: ./.github/actions/setup-rust | |
- run: pnpm run build | |
- run: pnpm run check | |
- run: pnpm run test | |
- run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> "$HOME/.npmrc" | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- run: | | |
{ | |
echo 'CHANGESET_RESPONSE<<EOF' | |
pnpm changeset version --snapshot snapshot | |
pnpm changeset publish --snapshot --no-git-tag --tag snapshot | |
echo EOF | |
} >> "$GITHUB_OUTPUT" | |
id: changeset_release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/github-script@v6 | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
COMMENT_ID: ${{ github.event.comment.id }} | |
COMMENT_BODY: | | |
:snapshot_release | |
```bash | |
${{ steps.changeset_release.outputs.CHANGESET_RESPONSE }} | |
``` | |
with: | |
script: | | |
github.rest.issues.updateComment({ | |
comment_id: process.env.COMMENT_ID, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: process.env.COMMENT_BODY | |
}) |