2024-03-16 02:36:04 +00:00
name : release-pr
2023-05-15 21:26:21 +00:00
on :
issue_comment :
types : [ created]
env :
# 7 GiB by default on GitHub, setting to 6 GiB
NODE_OPTIONS : --max-old-space-size=6144
2023-06-02 17:14:21 +00:00
permissions :
contents : read
2023-05-15 21:26:21 +00:00
jobs :
release-pr :
2023-07-20 09:58:58 +00:00
if : github.repository == 'nuxt/nuxt' && github.event.issue.pull_request && github.event.comment.body == '/trigger release'
2023-05-15 21:26:21 +00:00
permissions :
id-token : write
2023-05-15 21:53:25 +00:00
pull-requests : write
2023-05-15 21:26:21 +00:00
runs-on : ubuntu-latest
timeout-minutes : 20
steps :
- name : Ensure action is by maintainer
2024-05-14 16:43:40 +00:00
uses : octokit/request-action@872c5c97b3c85c23516a572f02b31401ef82415d # v2.3.1
2023-05-15 21:26:21 +00:00
id : check_role
with :
2023-05-15 21:31:14 +00:00
route : GET /repos/nuxt/nuxt/collaborators/${{ github.event.comment.user.login }}
2023-05-15 21:26:21 +00:00
env :
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
2024-06-19 19:09:04 +00:00
- name : Get PR Info
id : pr
env :
PR_NUMBER : ${{ github.event.issue.number }}
GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
GH_REPO : ${{ github.repository }}
COMMENT_AT : ${{ github.event.comment.created_at }}
run : |
pr="$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/${GH_REPO}/pulls/${PR_NUMBER})"
head_sha="$(echo "$pr" | jq -r .head.sha)"
updated_at="$(echo "$pr" | jq -r .updated_at)"
2024-06-24 09:40:33 +00:00
if [[ $(date -d "$updated_at" +%s) -gt $(date -d "$COMMENT_AT" +%s) ]]; then
exit 1
fi
2024-06-19 19:09:04 +00:00
echo "head_sha=$head_sha" >> $GITHUB_OUTPUT
2024-06-13 12:37:54 +00:00
- uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
2023-05-15 21:26:21 +00:00
with :
2024-06-19 19:09:04 +00:00
ref : ${{ steps.pr.outputs.head_sha }}
fetch-depth : 1
2023-05-15 21:26:21 +00:00
- run : corepack enable
2024-02-07 09:59:54 +00:00
- uses : actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
2023-05-15 21:26:21 +00:00
with :
2023-09-11 22:46:22 +00:00
node-version : 20
2023-05-15 21:26:21 +00:00
cache : "pnpm"
- name : Install dependencies
run : pnpm install
- name : Build
run : pnpm build
- name : Release Edge
2023-05-15 21:56:42 +00:00
run : ./scripts/release-edge.sh pr-${{ github.event.issue.number }}
2023-05-15 21:26:21 +00:00
env :
NODE_AUTH_TOKEN : ${{ secrets.NODE_AUTH_TOKEN }}
NPM_CONFIG_PROVENANCE : true
2023-05-15 21:53:25 +00:00
- name : Post comment
2023-11-20 09:31:18 +00:00
uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
2023-05-15 21:53:25 +00:00
with :
github-token : ${{ secrets.GITHUB_TOKEN }}
script : |
github.rest.issues.createComment({
issue_number : context.issue.number,
owner : context.repo.owner,
repo : context.repo.repo,
2023-10-12 14:17:38 +00:00
body: `:rocket : Release triggered! You can now install [nuxt@npm:nuxt-nightly@pr-${{ github.event.issue.number }}](https://www.npmjs.com/package/nuxt-nightly/v/pr-${{ github.event.issue.number }})`
2023-05-15 21:53:25 +00:00
})