-
Notifications
You must be signed in to change notification settings - Fork 37
131 lines (112 loc) · 3.87 KB
/
main.yaml
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
---
name: 'EBBR CI Build'
# yamllint disable-line rule:truthy
on:
push:
branches: '**'
tags: 'v*'
pull_request:
branches: main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 'Compute IRC message'
# We compute a message only for events happening in the main repository
# and only in the following cases:
# - Push of a tag or to the main branch
# - Pull request opened for the main branch of the main repository.
if: ${{ github.repository == 'ARM-software/ebbr' }}
run: |
tmp="/tmp/tmp.$$"
cat >"$tmp" <<EOF
${{ github.event.head_commit.message }}
EOF
case "${{ github.event_name }}" in
push)
case "${{ github.event.ref }}" in
refs/heads/main|refs/tags/*)
title=$(head -1 "$tmp")
msg="Push ${{ github.event.ref }} (\"$title\")"
url="${{ github.event.head_commit.url }}"
;;
esac ;;
pull_request)
if [ "${{ github.event.action }}" == opened ] &&
[ "${{ github.event.pull_request.base.ref }}" == main ]; then
msg="Pull request ${{ github.event.number }}"
msg="$msg (\"${{ github.event.pull_request.title }}\")"
msg="$msg ${{ github.event.action }}"
url="${{ github.event.pull_request.html_url }}"
fi ;;
esac
echo "EBBR_IRC_MESSAGE=$msg" >> $GITHUB_ENV
echo "EBBR_IRC_URL=$url" >> $GITHUB_ENV
rm -f "$tmp"
- name: 'Notify IRC'
uses: Gottox/irc-message-action@v2
# We notify IRC only for the main repository
# and when we have computed a message.
if: ${{ github.repository == 'ARM-software/ebbr' &&
env.EBBR_IRC_MESSAGE != '' }}
with:
server: irc.oftc.net
channel: '#ebbr'
nickname: ebbr-bot
message: |-
${{ env.EBBR_IRC_MESSAGE }}
${{ env.EBBR_IRC_URL }}
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
# checkout@v3 doesn't preserve annotations when fetching the tag
# Forcing the tags to be fetched fixes it so the version is correct
- name: 'Identify Version'
run: |
git fetch --force --tags
echo "EBBR_VERSION=$(git describe)" >> $GITHUB_ENV
- name: 'Install Debian required packages'
run: |
sudo apt update
sudo apt install python3-pip latexmk libalgorithm-diff-perl texlive \
texlive-latex-extra texlive-humanities flake8 mypy yamllint
- name: 'Install Python required packages'
run: |
pip3 install --user mako
pip3 install --user typing
pip3 install --user Sphinx
- name: 'Check'
run: make check
- name: 'Build PDF'
run: |
make latexpdf
cp build/latex/ebbr.pdf build/ebbr-${{ env.EBBR_VERSION }}.pdf
- name: 'Build HTML'
run: make html
- name: 'Build Single HTML'
run: make singlehtml
- name: 'Build Text'
run: make text
- name: 'Upload artifacts'
uses: actions/upload-artifact@v3
with:
name: ebbr-${{ env.EBBR_VERSION }}
path: |
build/ebbr-*.pdf
build/html/
build/singlehtml/
build/text/
- name: 'Deploy to Github Pages'
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/main' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build/singlehtml
- name: 'Publish Release'
uses: softprops/action-gh-release@v1
if: endsWith(github.ref, env.EBBR_VERSION)
with:
files: build/ebbr-*.pdf
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}