-
Notifications
You must be signed in to change notification settings - Fork 2
119 lines (96 loc) · 3.53 KB
/
pros-build.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
name: Build Template
on:
push:
branches: "**"
pull_request:
branches: "**"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Get short SHA
id: short-sha
run: |
if [ $ACTION = opened ]; then
# we have to get the head sha directly from the pr api, because github silly ig
echo "then"
sha=$(wget -O- --quiet https://api.github.com/repos/LemLib/LemLog/pulls/$PR_NUM | jq -r .head.sha | head -c 6)
else
echo "else"
sha=$(echo $SHA | head -c 6)
fi
echo "sha=$sha" >> $GITHUB_OUTPUT
env:
SHA: ${{ github.event.after }} # this isn't present for pr opened events
ACTION: ${{github.event.action}}
PR_NUM: ${{github.event.number}}
- name: Set short SHA
run: echo $SHA
env:
SHA: ${{ steps.short-sha.outputs.sha }}
- name: Install ARM Toolchain
uses: fiam/arm-none-eabi-gcc@v1
with:
release: "10-2020-q4"
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: PIP Installer
uses: BSFishy/pip-action@v1
with:
packages: pros-cli
- name: Testing PROS Install
run: pros --version
- name: Checkout
uses: actions/checkout@v2.3.4
- name: Get version number
id: version
run: |
version=$(awk -F'=' '/^VERSION:=/{print $2}' Makefile)
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: Get Template Postfix
id: template-postfix
run: |
echo postfix="$VER+$SHA" >> "$GITHUB_OUTPUT"
env:
SHA: ${{ steps.short-sha.outputs.sha }}
VER: ${{ steps.version.outputs.version }}
- name: Get Template Name
id: template-name
run: |
echo name=$TEMPLATE_NAME@$POSTFIX >> "$GITHUB_OUTPUT"
env:
POSTFIX: ${{ steps.template-postfix.outputs.postfix }}
TEMPLATE_NAME: ${{ github.event.repository.name }}
- name: Update version in Makefile
run: sed -i "s/^VERSION:=.*\$/VERSION:=$POSTFIX/" Makefile
env:
POSTFIX: ${{ steps.template-postfix.outputs.postfix }}
- name: Build PROS Project
run: make clean quick -j
- name: Create template
run: pros make template
- name: Create template folder
run: mkdir -p template/include/lemlog/
- name: Copy LICENSE and README.md into template
run: cp {LICENSE,README.md} template/include/lemlog/
- name: Append GitHub link to README.md
run: echo "\n## [Github link](${{github.server_url}}/${{github.repository}})" >> template/include/lemlog/README.md
- name: Fix relative Github links in README.md
run: perl -i -pe 's@(?<=[^/])(docs/assets/.*?)(?=[")])@${{github.server_url}}/${{github.repository}}/blob/master/$1?raw=true@g' template/include/lemlog/README.md
- name: Unzip Template
uses: montudor/action-zip@v1.0.0
with:
args: unzip "${{steps.template-name.outputs.name}}.zip" -d template
- name: Create VERSION file
run: echo $POSTFIX > template/include/lemlog/VERSION
env:
POSTFIX: ${{ steps.template-postfix.outputs.postfix }}
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ steps.template-name.outputs.name }}
path: "template/*"
retention-days: 89