-
Notifications
You must be signed in to change notification settings - Fork 55
75 lines (67 loc) · 2.42 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
name: Release specification
on:
workflow_dispatch:
push:
branches: master
jobs:
make-release:
name: Make and publish spec release
runs-on: ubuntu-latest
permissions:
contents: write # required to publish (tag) a release
steps:
- name: Clone main
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
with:
fetch-depth: 0
- name: Get previous version
id: prevver
run: |
prev_version=`git tag | sort -V -r | head -n 1 | cut -c 2-`
echo "prev_version=$prev_version" >> $GITHUB_OUTPUT
- name: Get version
id: getver
run: |
spec_version=`grep -oP 'VERSION \K(\d+\.\d+\.\d+)' tuf-spec.md`
echo "spec_version=$spec_version" >> $GITHUB_OUTPUT
- name: Set up Python
if: steps.getver.outputs.spec_version != steps.prevver.outputs.prev_version
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c
with:
python-version: '3.10'
cache: 'pip'
- name: Make release
if: steps.getver.outputs.spec_version != steps.prevver.outputs.prev_version
uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.getver.outputs.spec_version }}
release_name: v${{ steps.getver.outputs.spec_version }}
body: Specification release v${{ steps.getver.outputs.spec_version }}
- name: Build specification
if: steps.getver.outputs.spec_version != steps.prevver.outputs.prev_version
run: |
python -m pip install -r requirements.txt
mkdir build && cd build
make -f ../Makefile release
- name: Switch branch
if: steps.getver.outputs.spec_version != steps.prevver.outputs.prev_version
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
with:
ref: gh-pages
clean: false
- name: Push generated specification
if: steps.getver.outputs.spec_version != steps.prevver.outputs.prev_version
env:
SPEC_VERSION: v${{ steps.getver.outputs.spec_version }}
run: |
git config user.name "TUF Specification Automation"
git config user.email [email protected]
rm -fr latest
mv build/* .
rmdir build
make index
git add .
git commit -m "Publish latest specification $SPEC_VERSION"
git push