-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
69 lines (58 loc) · 2.01 KB
/
release.yml
File metadata and controls
69 lines (58 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
filter: 'tree:0'
persist-credentials: false
show-progress: false
- 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@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
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 target_commitish = process.env.DEFAULT_BRANCH;
const name = tag_name;
const { data: release } = await github.rest.repos.createRelease({
owner,
repo,
tag_name,
target_commitish,
name,
draft,
generate_release_notes: true,
});
core.notice(`Created release ${release.name}: ${release.html_url}`);