-
Notifications
You must be signed in to change notification settings - Fork 0
162 lines (139 loc) · 4.23 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
name: Release
run-name: bump ${{ inputs.version }} version by @${{ github.actor }}
on:
workflow_dispatch:
inputs:
version:
type: choice
description: 'part of the project version to update'
options:
- major
- minor
- patch
required: true
env:
PIP_NO_OPTION: on
PIP_NO_CLEAN: on
PIP_PREFER_BINARY: on
permissions:
contents: write
packages: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
release:
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
tag: ${{ steps.release.outputs.tag }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Cache requirements
uses: actions/cache@v4
env:
cache-name: cache-requirements
with:
path: ~/.cache/pip
key: ${{ env.cache-name }}-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ env.cache-name }}-
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install requirements
run: make setup
- name: Configure git
env:
MEX_BOT_EMAIL: ${{ vars.MEX_BOT_EMAIL }}
MEX_BOT_USER: ${{ vars.MEX_BOT_USER }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PUB: ${{ secrets.SIGNING_PUB }}
run: |
eval "$(ssh-agent -s)"
pdm setup-commit-signing
- name: Release new version
id: release
env:
GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
run: |
pdm release ${{ inputs.version }}
echo "tag=$(git describe --abbrev=0 --tags)" >> "$GITHUB_OUTPUT"
containerize:
runs-on: ubuntu-latest
timeout-minutes: 10
needs: release
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Cache requirements
uses: actions/cache@v4
env:
cache-name: cache-requirements
with:
path: ~/.cache/pip
key: ${{ env.cache-name }}-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ env.cache-name }}-
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install requirements
run: make setup
- name: Generate locked requirements.txt
run: |
pdm export --self --output locked-requirements.txt --no-hashes --without dev
- name: Login to container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: Build, tag and push docker image
run: |
docker build . \
--tag ghcr.io/robert-koch-institut/mex-editor:latest \
--tag ghcr.io/robert-koch-institut/mex-editor:${{ github.sha }} \
--tag ghcr.io/robert-koch-institut/mex-editor:${{ needs.release.outputs.tag }}
docker push --all-tags ghcr.io/robert-koch-institut/mex-editor
distribute:
runs-on: ubuntu-latest
timeout-minutes: 10
needs: release
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Cache requirements
uses: actions/cache@v4
env:
cache-name: cache-requirements
with:
path: ~/.cache/pip
key: ${{ env.cache-name }}-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ env.cache-name }}-
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install requirements
run: make setup
- name: Build wheel and sdist distros and create a github release
env:
GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
PDM_CHECK_UPDATE: False
run: |
gh release create ${{ needs.release.outputs.tag }} --generate-notes --latest --verify-tag
pdm build --dest dist
for filename in dist/*; do
gh release upload ${{ needs.release.outputs.tag }} ${filename};
done