release #1
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: release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'The version to create the release for.' | |
required: true | |
type: string | |
permissions: {} | |
jobs: | |
release: | |
runs-on: [ ubuntu-latest ] | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: false | |
permissions: | |
contents: write | |
issues: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | |
- name: Create release | |
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | |
env: | |
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} | |
VERSION: ${{ inputs.version }} | |
with: | |
script: | | |
const { repo, owner } = context.repo; | |
const draft = true; | |
let version = process.env.VERSION; | |
if (version.startsWith('v')) { | |
version = version.slice(1); | |
} | |
const tag_name = version; | |
const name = tag_name; | |
const { data: notes } = await github.rest.repos.generateReleaseNotes({ | |
owner, | |
repo, | |
tag_name, | |
target_commitish: process.env.DEFAULT_BRANCH, | |
}); | |
const body = notes.body | |
.split('\n') | |
.filter((line) => !line.includes(' @dependabot ')) | |
.filter((line) => !line.includes(' @github-actions ')) | |
.filter((line) => !line.includes(' @polly-updater-bot ')) | |
.join('\n'); | |
const { data: release } = await github.rest.repos.createRelease({ | |
owner, | |
repo, | |
tag_name, | |
name, | |
body, | |
draft, | |
}); | |
core.notice(`Created release ${release.name}: ${release.html_url}`); |