-
Notifications
You must be signed in to change notification settings - Fork 258
130 lines (98 loc) · 3.4 KB
/
release.yml
File metadata and controls
130 lines (98 loc) · 3.4 KB
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
name: release
# Automate publishing to PyPI and TestPyPI. When pushing a release tag vX.Y.Z,
# the workflow will publish to PyPI. When the 'test-release' label is active on
# a PR, the workflow will publish to TestPyPI on each update. In both cases it
# is checked if pre-commit and the tests pass. When a release tag is pushed it
# will in addition check if the tag and aiida-core version and tag match.
on:
# pull request event we use for test releases
pull_request:
branches-ignore: [gh-pages]
paths-ignore: [docs/**]
# tag push event we use for the official release
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+*
env:
FORCE_COLOR: 1
jobs:
check-release-tag:
if: github.repository == 'aiidateam/aiida-core' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-24.04
steps:
- name: Checkout repo
uses: actions/checkout@v6
- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Check tag
run: python .github/workflows/check_release_tag.py $GITHUB_REF
pre-commit:
if: startsWith(github.ref, 'refs/tags/') || (github.event_name == 'pull_request' && contains(fromJson(toJson(github.event.pull_request.labels)).*.name, 'test-release'))
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v6
- name: Install aiida-core and pre-commit
uses: ./.github/actions/install-aiida-core
with:
python-version: '3.11'
extras: pre-commit
from-lock: 'false'
- name: Run pre-commit
run: pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )
tests:
if: startsWith(github.ref, 'refs/tags/') || (github.event_name == 'pull_request' && contains(fromJson(toJson(github.event.pull_request.labels)).*.name, 'test-release'))
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v6
- name: Install aiida-core
uses: ./.github/actions/install-aiida-core
- name: Run sub-set of test suite
run: pytest -s -m requires_broker --broker-backend zmq --db-backend=sqlite tests/
publish-pypi:
if: startsWith(github.ref, 'refs/tags/')
name: Publish to PyPI
needs: [check-release-tag, pre-commit, tests]
runs-on: ubuntu-24.04
environment: release
permissions:
id-token: write
steps:
- name: Checkout source
uses: actions/checkout@v6
- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Install flit
run: pip install flit~=3.4
- name: Build
run: flit build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
publish-testpypi:
if: github.event_name == 'pull_request' && contains(fromJson(toJson(github.event.pull_request.labels)).*.name, 'test-release')
name: Publish to test PyPI
needs: [pre-commit, tests]
runs-on: ubuntu-24.04
environment: release
permissions:
id-token: write
steps:
- name: Checkout source
uses: actions/checkout@v6
- name: Set up Python 3.10
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Install flit
run: pip install flit~=3.4
- name: Build
run: flit build
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/