-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (55 loc) · 1.44 KB
/
release.yml
File metadata and controls
61 lines (55 loc) · 1.44 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
name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
tag:
description: 'Tag to release (e.g. v1.2.3)'
required: true
workflow_call:
inputs:
tag:
description: 'Tag to release'
required: true
type: string
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Build package
run: |
pip install build
python -m build
- name: Create Release
env:
GH_TOKEN: ${{ github.token }}
run: |
TAG=${{ inputs.tag || github.ref_name }}
gh release create "$TAG" \
dist/* \
--generate-notes \
--title "Release $TAG"
- name: Update major version tag
run: |
TAG=${{ inputs.tag || github.ref_name }}
# If tag is v1.2.3, MAJOR is v1
if [[ $TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
MAJOR=${TAG%%.*}
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -fa $MAJOR -m "Update $MAJOR tag"
git push origin $MAJOR --force
fi