-
Notifications
You must be signed in to change notification settings - Fork 6
129 lines (127 loc) · 4.11 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: release
on:
workflow_dispatch:
permissions:
contents: write
jobs:
test-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
- run: python -m pip install ".[dev]"
- run: mkdocs build --clean --strict
# Need to ensure we bump before we create any artifacts
bump:
runs-on: ubuntu-latest
needs: [test-docs]
steps:
- uses: actions/checkout@v4
with:
fetch-tags: 1 # Essential to later commitizen
fetch-depth: 0 # Recommended by the action
token: ${{ secrets.PUSH_ACCESS }}
- run: git tag # Debug statement
- name: Create bump and changelog
uses: commitizen-tools/commitizen-action@master
id: cz
with:
github_token: ${{ secrets.PUSH_ACCESS }}
debug: true
changelog_increment_filename: changelog-increment.md
- run: |
mkdir changelog-output
mv changelog-increment.md changelog-output/changelog-increment.md
cat changelog-output/changelog-increment.md
- name: Upload the changelog
uses: actions/upload-artifact@v4
with:
name: changelog
path: changelog-output
build:
needs: [bump]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: "main" # Necessary to download the latest of main as this will have been updated on the step before
fetch-tags: 1
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
- run: python -m pip install build
- run: python -m build --sdist
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: build-output
path: dist
docs:
needs: [bump]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.11
- uses: actions/cache@v2
with:
key: ${{ github.ref }}
path: .cache
- run: python -m pip install mkdocs-material mkdocs-autorefs mkdocs-glightbox mkdocs-literate-nav mkdocstrings[python] mkdocs-gen-files mkdocs-awesome-pages-plugin typing-extensions more-itertools pillow cairosvg mike markdown-exec
- run: mkdocs gh-deploy --force
release:
needs: [docs, build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: "main" # Necessary to download the latest of main as this will have been updated on the step before
fetch-tags: 1
fetch-depth: 0
- name: Download the build artifiact
uses: actions/download-artifact@v4
with:
name: build-output
path: dist
- run: ls -R dist
- name: Download the changelog
uses: actions/download-artifact@v4
with:
name: changelog
path: changelog-output
- run: |
ls -R changelog-output
mv changelog-output/changelog-increment.md changelog-increment.md
cat changelog-increment.md
- name: "Create Github Release"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
current_version=$(git tag | sort --version-sort | tail -n 1)
echo "Release for ${current_version}"
gh release create \
--generate-notes \
--notes-file changelog-increment.md \
--verify-tag \
"${current_version}" "dist/quicktunetool-${current_version}.tar.gz"
publish:
needs: [release]
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
with:
ref: "main" # Necessary to download the latest of main as this will have been updated on the step before
- uses: actions/download-artifact@v4
with:
name: build-output
path: dist
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1