Release/1.0.4 #4
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: Canary Release | ||
on: | ||
issue_comment: | ||
types: | ||
- created | ||
permissions: | ||
contents: read | ||
pull-request: write | ||
Check failure on line 10 in .github/workflows/canary-release.yml GitHub Actions / Canary ReleaseInvalid workflow file
|
||
package: write | ||
jobs: | ||
canary release: | ||
name: canary release | ||
runs-on: ubuntu-latest | ||
if: | | ||
github.event_name == 'issue_comment' && | ||
(github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'CONTRIBUTOR') && | ||
startsWith(github.event.comment.body, 'canary-release') | ||
steps: | ||
- name: get PR information | ||
uses: actions/github-script@v4 | ||
id: pr | ||
with: | ||
script: | | ||
const request = { | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
pull_number: context.issue.number | ||
} | ||
core.info(`Getting PR #${request.pull_number} from ${request.owner}/${request.repo}`) | ||
try { | ||
const result = await github.pulls.get(request); | ||
core.info(`Got PR: ${JSON.stringify(result.data)}`); | ||
return result.data; | ||
} catch (err) { | ||
core.setFailed(`Request failed with error: ${err}`) | ||
} | ||
- name: checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ fromJSON(steps.pr.outputs.result).head.ref }} | ||
repository: ${{ fromJSON(steps.pr.output.result).head.repo.full_name }} | ||
fetch-depth: 0 | ||
- name: setup NodeJS | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20.x | ||
registry-url: 'https://npm.pkg.github.com' | ||
- name: Setup PNPM | ||
uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8.11 | ||
- name: Install | ||
run: pnpm install | ||
- name: Publish | ||
run: pnpm run release:canary | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: actions/github-script@v4 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
github.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: '🎉 Canary Release. You can install canary version via `npm install [package]@next`' | ||
}) |