-
Notifications
You must be signed in to change notification settings - Fork 19
67 lines (62 loc) · 1.97 KB
/
Copy pathgithub-release.yml
File metadata and controls
67 lines (62 loc) · 1.97 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
name: github-release
permissions:
contents: write
on:
workflow_dispatch:
inputs:
release-branch:
description: "Branch to create release from"
required: false
default: "main"
increment:
description: "Version increment type"
required: false
type: choice
options:
- patch
- minor
- major
default: "patch"
prerelease_type:
description: "Prerelease type"
required: false
type: choice
options:
- none
- alpha
- beta
- rc
default: "none"
draft:
description: "Create as draft release"
required: false
type: boolean
default: false
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
ref: ${{ inputs.release-branch }}
- name: Check actor is a repository admin
run: |
PERMISSION=$(gh api repos/${{ github.repository }}/collaborators/${{ github.actor }}/permission --jq '.permission')
echo "Permission level for ${{ github.actor }}: $PERMISSION"
if [ "$PERMISSION" != "admin" ]; then
echo "::error::${{ github.actor }} is not a repository admin. Only admins can trigger releases."
exit 1
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create GitHub Release with Commitizen
uses: serapeum-org/github-actions/actions/release/github@38c111084f99d5ff5f4a1e63bedce48fe33a10c0 # github-release/v1.5.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
increment: ${{ github.event.inputs.increment }}
prerelease-type: ${{ github.event.inputs.prerelease_type }}
draft: ${{ github.event.inputs.draft }}
package-manager: pixi
install-groups: "dev"