mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 15:15:19 +00:00
db52ee6f5f
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
85 lines
2.7 KiB
YAML
85 lines
2.7 KiB
YAML
name: release-pr
|
|
|
|
on:
|
|
issue_comment:
|
|
types: [created]
|
|
|
|
env:
|
|
# 7 GiB by default on GitHub, setting to 6 GiB
|
|
NODE_OPTIONS: --max-old-space-size=6144
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
release-pr:
|
|
if: github.repository == 'nuxt/nuxt' && github.event.issue.pull_request && github.event.comment.body == '/trigger release'
|
|
concurrency:
|
|
group: release
|
|
permissions:
|
|
id-token: write
|
|
pull-requests: write
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
|
|
steps:
|
|
- name: Ensure action is by maintainer
|
|
uses: octokit/request-action@dad4362715b7fb2ddedf9772c8670824af564f0d # v2.4.0
|
|
id: check_role
|
|
with:
|
|
route: GET /repos/nuxt/nuxt/collaborators/${{ github.event.comment.user.login }}
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- 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)"
|
|
|
|
if [[ $(date -d "$updated_at" +%s) -gt $(date -d "$COMMENT_AT" +%s) ]]; then
|
|
exit 1
|
|
fi
|
|
|
|
echo "head_sha=$head_sha" >> "$GITHUB_OUTPUT"
|
|
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
|
|
with:
|
|
ref: ${{ steps.pr.outputs.head_sha }}
|
|
fetch-depth: 1
|
|
|
|
- run: corepack enable
|
|
- uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
|
|
with:
|
|
node-version: 20
|
|
cache: "pnpm"
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install
|
|
|
|
- name: Build
|
|
run: pnpm build
|
|
|
|
- name: Release Edge
|
|
run: ./scripts/release-edge.sh pr-${{ github.event.issue.number }}
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
|
|
NPM_CONFIG_PROVENANCE: true
|
|
|
|
- name: Post comment
|
|
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
script: |
|
|
github.rest.issues.createComment({
|
|
issue_number: context.issue.number,
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
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 }})`
|
|
})
|