-
Notifications
You must be signed in to change notification settings - Fork 3
138 lines (118 loc) · 3.82 KB
/
release.yaml
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
130
131
132
133
134
135
136
137
138
name: release
on:
workflow_dispatch:
inputs:
level:
type: choice
description: 'Version level increment'
options:
- patch
- minor
- major
required: true
default: 'patch'
publish:
type: boolean
description: 'Publish package'
required: true
default: false
defaults:
run:
shell: bash
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: setup environment
run: |
sudo ln -fs /usr/share/zoneinfo/Europe/Stockholm /etc/localtime
sudo ln -fs /usr/share/zoneinfo/Europe/Stockholm /etc/timezone
echo $HOME/.local/bin >> $GITHUB_PATH
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: setup python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- name: setup node
id: setup-node
uses: actions/setup-node@v4
- name: get latest tag
uses: mgor/[email protected]
id: get-latest-tag
with:
semver_only: true
initial_version: 'v0.0.0'
with_initial_version: true
- name: next version
uses: mgor/[email protected]
id: next-version
with:
current_version: ${{ steps.get-latest-tag.outputs.tag }}
level: ${{ github.event.inputs.level }}
- name: create release tag
run: |
echo "current version is ${{ steps.get-latest-tag.outputs.tag }}"
echo "next version is ${{ steps.next-version.outputs.new_version }}"
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git tag -a "${{ steps.next-version.outputs.new_version }}" -m "Release ${{ steps.next-version.outputs.new_version }}"
- name: install python dependencies
id: install-python-deps
run: |
python -m pip install -e .[ci,docs]
- name: build package
id: build
run: python -m build
- name: verify package
id: verify
working-directory: ./dist/
env:
VERSION: ${{ steps.next-version.outputs.new_version }}
run: |
set -e
ls -l grizzly?loadtester-${VERSION#v}*
test -f grizzly-loadtester-${VERSION#v}.tar.gz
test -f grizzly_loadtester-${VERSION#v}-py3-none-any.whl
- name: publish package
id: publish
if: ${{ github.event.inputs.publish == 'true' }}
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
TWINE_NON_INTERACTIVE: true
VERSION: ${{ steps.next-version.outputs.new_version }}
run: python -m twine upload dist/grizzly?loadtester-${VERSION#v}*
- name: push release tag
id: release-tag
if: ${{ github.event.inputs.publish == 'true' }}
run: git push origin "${{ steps.next-version.outputs.new_version }}"
- name: prepare "edit this page" links
id: edit-this-page-links
run: |
if [[ "${{ github.event.inputs.publish }}" == "true" ]]; then
tag="${{ steps.next-version.outputs.new_version }}"
else
tag="$(git tag | tail -1)"
fi
git checkout -b "${tag}" "tags/${tag}"
- name: build documentation
working-directory: ./docs/
id: build-docs
run: python -m novella --site-dir "./_build" --base-url grizzly/
- name: deploy documentation
id: deploy-docs
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: ./docs/_build
destination_dir: docs/
enable_jekyll: false
# cname: <a better domain>
allow_empty_commit: true
commit_message: 'Documentation for release ${{ steps.next-version.outputs.new_version }}'