Skip to content

release

release #9

Workflow file for this run

name: release
on:
workflow_dispatch:
inputs:
publish:
description: 'If true, does not create the release as a draft.'
required: false
type: boolean
default: false
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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Get version
id: get-version
shell: pwsh
run: |
$properties = Join-Path "." "Directory.Build.props"
$xml = [xml](Get-Content $properties)
$version = $xml.SelectSingleNode('Project/PropertyGroup/VersionPrefix').InnerText
"version=${version}" >> $env:GITHUB_OUTPUT
- name: Create release
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
env:
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
DRAFT: ${{ inputs.publish != true }}
VERSION: ${{ steps.get-version.outputs.version }}
with:
script: |
const { repo, owner } = context.repo;
const draft = process.env.DRAFT === 'true';
const version = process.env.VERSION;
const tag_name = `v${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 '))
.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}`);