-
Notifications
You must be signed in to change notification settings - Fork 343
145 lines (138 loc) · 4.92 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# must do before using this action:
# - set up RELEASE_TOKEN in secrets of the repository avocado-framework/avocado
# - set up RTD_TOKEN in secrets to update readthedocs
# - set up two tokens for twine: PYPI_USER and PYPI_PASSWD
name: Release tests
on:
workflow_dispatch:
inputs:
version:
description: 'Release version'
required: true
default: '0.0'
devel_name:
description: 'Developer Name'
required: true
default: 'Avocado Developer'
devel_mail:
description: 'Developer mail'
required: true
default: '[email protected]'
rtd_project:
description: 'readthedocs project name'
required: true
default: 'avocado-framework'
jobs:
release:
name: Release pipeline
runs-on: ubuntu-latest
container:
image: fedora:34
env:
VERSION: ${{ github.event.inputs.version }}
DEVEL_NAME: ${{ github.event.inputs.devel_name }}
DEVEL_MAIL: ${{ github.event.inputs.devel_mail }}
PYTHON: /usr/bin/python3
TOKEN_RTD: ${{ secrets.RTD_TOKEN }}
URL: "https://readthedocs.org/api/v3/projects/${{ github.event.inputs.rtd_project }}"
steps:
- name: Generate token
id: generate_token
uses: tibdex/github-app-token@021a2405c7f990db57f5eae5397423dcc554159c
with:
app_id: ${{ secrets.MR_AVOCADO_ID }}
installation_id: ${{ secrets.MR_AVOCADO_INSTALLATION_ID }}
private_key: ${{ secrets.MR_AVOCADO_PRIVATE_KEY }}
- name: install required packages
run: dnf -y install rpmdevtools git python3-pip make
- uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
- name: Update VERSION files and python-avocado.spec
run: |
make -f Makefile.gh propagate-version
make -f Makefile.gh release-update-spec
- name: Commit files and tag
run: |
git config --global --add safe.directory `pwd`
git config --local user.email "${{ github.event.inputs.devel_mail }}"
git config --local user.name "${{ github.event.inputs.devel_name }}"
make -f Makefile.gh release-commit-tag
- name: Push changes to github
uses: ad-m/github-push-action@master
with:
github_token: ${{ steps.generate_token.outputs.token }}
branch: ${{ github.ref }}
- name: Build wheel
run: make -f Makefile.gh build-wheel check-wheel
- name: Save wheel as artifact
uses: actions/upload-artifact@v4
with:
name: wheel
path: ${{github.workspace}}/PYPI_UPLOAD/
retention-days: 3
- name: Build documentation readthedocs
run: |
make -f Makefile.gh build-update-readthedocs
- run: >-
echo In a few minutes the release documentation will be available at
https://${{ github.event.inputs.rtd_project }}.readthedocs.io/en/${{ github.event.inputs.version }}/
| tee -a "${GITHUB_STEP_SUMMARY}"
publish-to-pypi:
name: Publish Avocado to PyPI
needs:
- release
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/avocado-framework/${{ github.event.inputs.version }}
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the wheels
uses: actions/download-artifact@v4
with:
name: wheel
path: dist/
- name: Publish avocado to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
build-and-publish-eggs:
name: Build eggs and publish them
runs-on: ubuntu-20.04
needs: release
strategy:
matrix:
python-version: [3.8.16, 3.9.16, 3.10.9, 3.11.1, 3.12.0]
fail-fast: false
steps:
- name: Generate token
id: generate_token
uses: tibdex/github-app-token@021a2405c7f990db57f5eae5397423dcc554159c
with:
app_id: ${{ secrets.MR_AVOCADO_ID }}
installation_id: ${{ secrets.MR_AVOCADO_INSTALLATION_ID }}
private_key: ${{ secrets.MR_AVOCADO_PRIVATE_KEY }}
- uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
ref: ${{ github.event.inputs.version }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Build eggs
run: |
if python -c 'import sys; exit(0) if sys.version_info.minor > 11 else exit(1)' ; then
pip install setuptools
fi
make -f Makefile.gh build-egg
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ steps.generate_token.outputs.token }}
file: ${{ github.workspace }}/EGG_UPLOAD/avocado_framework*egg
tag: ${{ github.event.inputs.version }}
overwrite: true
file_glob: true