95 lines
2.8 KiB
YAML
95 lines
2.8 KiB
YAML
# pulled from: https://github.com/changesets/changesets/pull/909
|
|
|
|
name: release-pr
|
|
|
|
on:
|
|
issue_comment:
|
|
types: [created]
|
|
|
|
env:
|
|
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
|
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
|
|
|
|
jobs:
|
|
deploy-check:
|
|
# this just checks if ur allowed to do the action so does not need to run on a fast machine
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: acknowledge deployment request to commenter
|
|
id: check
|
|
uses: khan/pull-request-comment-trigger@master
|
|
with:
|
|
trigger: "/release-pr"
|
|
reaction: rocket
|
|
env:
|
|
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
|
- name: validate user
|
|
id: validate_user
|
|
if: ${{ steps.check.outputs.triggered == 'true' }}
|
|
run: |
|
|
if [[ "${AUTHOR_ASSOCIATION}" != 'MEMBER' && "${AUTHOR_ASSOCIATION}" != 'OWNER' ]]
|
|
then
|
|
echo "User authorization failed"
|
|
exit 1
|
|
else
|
|
echo "User authorization successful"
|
|
fi
|
|
env:
|
|
AUTHOR_ASSOCIATION: ${{ github.event.comment.author_association }}
|
|
- name: check outputs
|
|
run: echo ${{ steps.check.outputs.triggered }}
|
|
|
|
outputs:
|
|
triggered: ${{ steps.check.outputs.triggered }}
|
|
comment_body: ${{ github.event.comment.body }}
|
|
|
|
deploy:
|
|
runs-on: ubuntu-latest-16
|
|
timeout-minutes: 30
|
|
needs: deploy-check
|
|
if: needs.deploy-check.outputs.triggered == 'true'
|
|
steps:
|
|
- name: get pull request ref
|
|
id: get_pull_request_ref
|
|
uses: octokit/[email protected]
|
|
with:
|
|
route: GET /repos/{owner}/{repository}/pulls/{issue_id}
|
|
owner: ${{ github.repository_owner }}
|
|
repository: ${{ github.event.repository.name }}
|
|
issue_id: ${{ github.event.issue.number }}
|
|
env:
|
|
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
|
|
|
- name: pull the repo.
|
|
uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: true
|
|
repository: ${{ fromJson(steps.get_pull_request_ref.outputs.data).head.repo.full_name }}
|
|
ref: ${{ fromJson(steps.get_pull_request_ref.outputs.data).head.ref }}
|
|
|
|
- name: Setup bun
|
|
uses: oven-sh/setup-bun@v1
|
|
with:
|
|
bun-version: 1.0.35
|
|
|
|
- name: Install
|
|
uses: ./.github/composite-actions/install
|
|
|
|
- name: Build
|
|
run: pnpm build
|
|
|
|
- name: Configure npm
|
|
run: |
|
|
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
|
|
env:
|
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
|
|
- name: Deploy pre-release
|
|
id: changesets
|
|
run: |
|
|
pnpm changeset version --snapshot dev
|
|
node ./scripts/pre-release.mjs
|
|
pnpm changeset publish --tag dev --no-git-tag
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|