-
Notifications
You must be signed in to change notification settings - Fork 5
88 lines (80 loc) · 2.68 KB
/
Copy pathgithub-release.yml
File metadata and controls
88 lines (80 loc) · 2.68 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: github-release
permissions:
contents: read
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:
pure-wheel-test:
uses: ./.github/workflows/pure-wheel-test.yml
release:
needs: pure-wheel-test
runs-on: ubuntu-latest
permissions:
contents: write
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
package-manager-version: v0.73.0
install-groups: "dev"
- name: Update lockfile after version bump
run: pixi lock
- name: Commit and push updated lockfile
env:
RELEASE_BRANCH: ${{ inputs.release-branch }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add pixi.lock
git diff --cached --quiet && echo "No lockfile changes" && exit 0
git commit -m "build: sync pixi.lock after version bump"
git push origin "$RELEASE_BRANCH"