-
-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (72 loc) · 1.99 KB
/
create-new-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: Create new release
on:
pull_request:
branches:
- main
types:
- closed
env:
tag-prefix: "v"
jobs:
push-tag:
name: Push a tag
if: ${{ contains(github.event.pull_request.labels.*.name, 'new release') && github.event.pull_request.merged }}
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
version: ${{ steps.tag.outputs.version }}
tag: ${{ steps.tag.outputs.tag }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Hatch
uses: pypa/hatch@install
- name: Configure git
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
- name: Push a tag
id: tag
run: |
version="$(hatch version)"
tag="${{ env.tag-prefix }}${version}"
git tag -a ${tag} -m "New release ${tag} (tagged by github-actions[bot])"
git push origin ${tag}
echo "version=${version}" >> $GITHUB_OUTPUT
echo "tag=${tag}" >> $GITHUB_OUTPUT
build-package:
needs:
- push-tag
uses: ./.github/workflows/build-pip-package.yml
with:
version: ${{ needs.push-tag.outputs.version }}
build-docs:
needs:
- push-tag
uses: ./.github/workflows/build-docs.yml
create-release:
name: Create a release
runs-on: ubuntu-latest
needs:
- push-tag
- build-package
- build-docs
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist
pattern: release--*
merge-multiple: true
- name: Create a release
uses: softprops/action-gh-release@v2
with:
draft: true
tag_name: ${{ needs.push-tag.outputs.tag }}
generate_release_notes: true
files: dist/*