-
Notifications
You must be signed in to change notification settings - Fork 190
132 lines (118 loc) · 3.33 KB
/
Copy pathrelease.yml
File metadata and controls
132 lines (118 loc) · 3.33 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
131
132
name: Publish release
on:
workflow_dispatch:
inputs:
branch:
description: The branch to release from
type: string
required: true
version:
description: The version number to release
type: string
required: true
prev_version:
description: The previously most up-to-date version number
type: string
required: true
jobs:
check:
name: Pre-release checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
path: firedrake-repo
ref: ${{ inputs.branch }}
- name: Check no 'TODO RELEASE' comments remain
working-directory: firedrake-repo
run: |
if [ -z "$( grep -r --exclude-dir='.*' 'TODO RELEASE' )" ]; then
exit 0
else
exit 1
fi
- name: Check version number matches
working-directory: firedrake-repo
run: |
if [ -z "$( grep 'version = \"${{ inputs.version }}\"' pyproject.toml )" ]; then
exit 1
else
exit 0
fi
sdist:
name: Create sdist
needs: check
runs-on: [self-hosted, Linux]
container:
image: ubuntu:latest
env:
OMPI_ALLOW_RUN_AS_ROOT: 1
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
# We don't need compiler optimisations here that might crash, we just need
# firedrake-check to pass
PYOP2_CFLAGS: -O0
steps:
- name: Pre-run cleanup
# Make sure the current directory is empty
run: find . -delete
- uses: actions/checkout@v5
with:
path: firedrake-repo
ref: ${{ inputs.branch }}
- name: Install Firedrake
uses: ./firedrake-repo/.github/actions/install
with:
os: linux
source_ref: ${{ inputs.branch }}
base_ref: release
- name: Create sdist
run: |
. venv/bin/activate
export $(python3 ./firedrake-repo/scripts/firedrake-configure --show-env)
env
pip install build
python -m build ./firedrake-repo --sdist
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: dist
path: firedrake-repo/dist/*
- name: Post-run cleanup
if: always()
run: find . -delete
pypi:
name: Upload sdist to PyPI
needs: sdist
runs-on: ubuntu-latest
environment:
name: pypi
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Push to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
# TODO: Use trusted publishing
password: ${{ secrets.PYPI_API_TOKEN }}
github_release:
name: Create GitHub release
needs: pypi
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v5
- name: Create release
env:
GH_TOKEN: ${{ github.token }}
run: gh release create --title ${{ inputs.version }} --target ${{ inputs.branch }} --generate-notes ${{ inputs.version }} --notes-start-tag ${{ inputs.prev_version }}
docker:
name: Build Docker containers
uses: ./.github/workflows/docker.yml
needs: pypi
with:
tag: ${{ inputs.version }}
branch: ${{ inputs.branch }}
secrets: inherit