-
Notifications
You must be signed in to change notification settings - Fork 79
141 lines (121 loc) · 4.1 KB
/
Copy pathci.yml
File metadata and controls
141 lines (121 loc) · 4.1 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
133
134
135
136
137
138
139
140
141
name: CI
on:
push:
branches:
- master*
- staging*
tags:
- "*"
pull_request:
branches:
- master*
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-24.04
timeout-minutes: 25
env:
ARM_GCC_DIR: /usr
steps:
- uses: actions/checkout@v6
with:
path: firmware
submodules: recursive
ref: ${{ github.event.pull_request.head.sha || github.ref }}
- name: Install build dependencies
run: |
sudo apt-get install -y gcc-arm-none-eabi
- name: Install west
run: pip3 install --user -U west
- name: Install python dependencies of scripts
run: |
cd firmware/scripts
pip install -r requirements.txt
- name: Setup Zephyr project
uses: zephyrproject-rtos/action-zephyr-setup@v1
with:
app-path: firmware
manifest-file-name: west_nrfsdk.yml
toolchains: arm-zephyr-eabi
sdk-version: 0.17.4
- name: Git user setup
run: |
git config --global user.email "git-patch@uhk.com"
git config --global user.name "Git Patch"
- name: West patch
run: west patch
- name: West config
run: |
west config build.cmake-args -- "-Wno-dev"
west config build.board_warn false
west config build.device_warn false
- name: mcuxsdk west setup
run: |
west config manifest.file west_mcuxsdk.yml
west update
west patch
- name: Use Node.js (.nvmrc)
uses: actions/setup-node@v6
with:
node-version-file: firmware/scripts/.nvmrc
- name: Install node dependencies in scripts folder
run: |
cd firmware/scripts
npm install
- name: Create firmware tarball
run: |
cd firmware
scripts/make-release.mjs --allowSha
- name: Upload firmware artifacts
uses: actions/upload-artifact@v7
with:
name: firmware
path: firmware/scripts/uhk-firmware-*.tar.gz
archive: false
retention-days: 90
- name: Run build-archiver
uses: UltimateHackingKeyboard/build-archiver@v0.0.5
if: github.repository == 'UltimateHackingKeyboard/firmware' && github.event.pull_request.head.repo.fork == false
with:
FILE_PATTERN: "firmware/scripts/uhk-firmware-*.tar.gz"
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
S3_ACCESS_KEY: ${{ secrets.UHK_BUILD_ARCHIVER_AWS_ACCESS_SECRET }}
S3_ACCESS_KEY_ID: ${{ secrets.UHK_BUILD_ARCHIVER_AWS_ACCESS_KEY }}
S3_BUCKET: "uhk-build-archives"
S3_KEY_PREFIX: "firmware/"
S3_REGION: "eu-central-1"
- name: Check whether tag is a version
id: version_check
if: github.ref_type == 'tag'
run: |
if [[ "${{ github.ref_name }}" =~ ^v?[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "is_version=true" >> $GITHUB_OUTPUT
else
echo "is_version=false" >> $GITHUB_OUTPUT
fi
- name: Strip `v` from git tag and
if: steps.version_check.outputs.is_version == 'true'
run: |
TAG_VERSION=${{ github.ref_name }}
TAG_VERSION=${TAG_VERSION#v}
echo "TAG_VERSION=$TAG_VERSION" >> $GITHUB_ENV
- name: Extract changelog
id: changelog
if: steps.version_check.outputs.is_version == 'true'
env:
VERSION: ${{ env.TAG_VERSION }}
run: |
cd firmware
DELIMITER=$(openssl rand -hex 16)
echo "content<<$DELIMITER" >> $GITHUB_OUTPUT
sed -n "/^## \\[${VERSION}\\]/,/^## \\[/p" CHANGELOG.md | sed '$d' | tail -n +3 >> $GITHUB_OUTPUT
echo "$DELIMITER" >> $GITHUB_OUTPUT
- name: Release
uses: softprops/action-gh-release@v3
if: steps.version_check.outputs.is_version == 'true'
with:
body: ${{ steps.changelog.outputs.content }}
draft: true
name: ${{ env.TAG_VERSION }}
files: firmware/scripts/uhk-firmware-*.tar.gz
token: ${{ secrets.GITHUB_TOKEN }}