-
-
Notifications
You must be signed in to change notification settings - Fork 30
83 lines (75 loc) · 2.66 KB
/
release.yml
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
name: Release
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
jobs:
build:
name: Build source distribution and wheels
if: github.repository == 'darvid/python-hyperscan' && !contains(github.event.head_commit.message, 'python-semantic-release')
uses: ./.github/workflows/wheels.yml
release:
name: Publish package
runs-on: ubuntu-22.04
concurrency: release
needs: build
if: github.repository == 'darvid/python-hyperscan' && !contains(github.event.head_commit.message, 'python-semantic-release')
permissions:
id-token: write
pull-requests: write
contents: write
env:
RELEASE_PR_BRANCH: create-pull-request/patch
steps:
- name: Checkout python-hyperscan
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
- uses: chainguard-dev/actions/setup-gitsign@main
- name: Check if release needed
id: release
uses: python-semantic-release/[email protected]
with:
force: "patch"
github_token: ${{ secrets.GITHUB_TOKEN }}
root_options: "-v --noop"
# python-semantic-release displays what it would have
# committed if commit is true and noop is set
commit: "true"
- name: Download artifacts
uses: actions/download-artifact@v4
if: github.event_name == 'workflow_dispatch' || steps.release.outputs.released == 'true'
- name: Prepare dist
if: github.event_name == 'workflow_dispatch' || steps.release.outputs.released == 'true'
run: |
mkdir dist
mv --backup=numbered ./wheel-*/*.whl -t dist/
mv --backup=numbered ./sdist/*.tar.gz -t dist/
ls -ahl dist/
rm -rf dist/*~
- name: Create release branch
if: steps.release.outputs.released == 'true'
run: |
# use the same default branch name that create-pull-request uses
git checkout -b ${RELEASE_PR_BRANCH}
git branch --set-upstream-to=${RELEASE_PR_BRANCH}
- name: Semantic release
uses: python-semantic-release/[email protected]
if: steps.release.outputs.released == 'true'
with:
force: "patch"
github_token: ${{ secrets.GITHUB_TOKEN }}
root_options: "-v"
- name: Create PR
if: steps.release.outputs.released == 'true'
run: |
gh pr create -B main -H $RELEASE_PR_BRANCH \
--title "$PR_TITLE" \
--body '🤖'
env:
PR_TITLE: "Release ${{ steps.release.outputs.version }}"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}