v2.2.0 #1
Workflow file for this run
This file contains hidden or 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: release | |
on: | |
pull_request_target: | |
types: [closed] | |
branches: | |
- main | |
# Remove default permissions of GITHUB_TOKEN for security | |
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs | |
permissions: {} | |
jobs: | |
release: | |
if: github.repository_owner == 'nuxt-contrib' && github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'v') | |
concurrency: | |
group: release | |
permissions: | |
contents: write | |
id-token: write | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
steps: | |
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
with: | |
fetch-depth: 0 | |
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 | |
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 | |
with: | |
node-version: latest | |
cache: "pnpm" | |
- name: 📦 Install dependencies | |
run: pnpm install | |
- name: 🛠 Build and release project | |
run: npm publish | |
- name: 🏷️ Create tag | |
env: | |
TAG_NAME: ${{ github.event.pull_request.head.ref }} | |
run: | | |
git tag "$TAG_NAME" | |
git push origin "$TAG_NAME" | |
- name: 🛳️ Create GitHub release | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TAG_NAME: ${{ github.event.pull_request.head.ref }} | |
RELEASE_NAME: ${{ github.event.pull_request.head.ref }} | |
BODY: ${{ github.event.pull_request.body }} | |
run: gh release create "$TAG_NAME" --title "$RELEASE_NAME" --notes "$BODY" |