Skip to content

Commit 958c31b

Browse files
committed
Add GitHub CI (with release archive automation)
Runs on: - commit push and tag push (meaning this runs twice when making a release) - pull request - manual run (needs write access), in which case a nightly archive artifact is producted with the run - release publish: properly makes and publishes the release archive
1 parent 6948d3e commit 958c31b

3 files changed

Lines changed: 76 additions & 0 deletions

File tree

.github/workflows/build.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: CI
2+
3+
on:
4+
push: # Note: will run on tags push too
5+
pull_request:
6+
workflow_dispatch: # manual run
7+
workflow_call:
8+
outputs:
9+
VERSTRING:
10+
description: Version string
11+
value: ${{ jobs.build.outputs.VERSTRING }}
12+
13+
jobs:
14+
build:
15+
name: Build boot.3dsx
16+
runs-on: ubuntu-latest
17+
outputs:
18+
VERSTRING: ${{ steps.verstring.outputs.VERSTRING }}
19+
container:
20+
image: devkitpro/devkitarm
21+
options: --user 1001 # runner user, for git safedir
22+
steps:
23+
- name: Checkout repo
24+
uses: actions/checkout@v4
25+
with:
26+
submodules: recursive # we currently don't use submodules, but just in case...
27+
fetch-depth: 0 # deep clone (for git describe)
28+
fetch-tags: true
29+
- name: Set version string
30+
id: verstring
31+
run: |
32+
VERSTRING=$(git describe --tags --match "v[0-9]*" --abbrev=7 | sed 's/-[0-9]*-g/-/')
33+
echo "VERSTRING=$VERSTRING" | tee -a $GITHUB_OUTPUT
34+
- name: Build
35+
run: make -j$(nproc --all)
36+
- name: Publish boot.3dsx (only on manual run or release)
37+
if: github.event_name == 'workflow_dispatch' || github.event_name == 'release'
38+
uses: actions/upload-artifact@v4
39+
with:
40+
# This produces a zip with boot.3dsx inside for security reasons
41+
# For publish_release this is presented as boot.3dsx however
42+
name: 3ds-hbmenu-${{ steps.verstring.outputs.VERSTRING }}
43+
path: boot.3dsx

.github/workflows/release.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Release CI
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
build:
9+
name: Build boot.3dsx
10+
uses: ./.github/workflows/build.yaml
11+
publish_release:
12+
name: Publish release archive
13+
needs: build
14+
runs-on: ubuntu-latest
15+
env:
16+
VERSTRING: ${{ needs.build.outputs.VERSTRING }}
17+
steps:
18+
- name: Download cacert.pem
19+
run: mkdir -p config/ssl && curl -sSfL "https://curl.se/ca/cacert.pem" -o config/ssl/cacert.pem
20+
- name: Download build artifact from previous job
21+
uses: actions/download-artifact@v4
22+
with:
23+
name: 3ds-hbmenu-${{ env.VERSTRING }}
24+
- name: Bundle release archive
25+
run: zip "3ds-hbmenu-$VERSTRING.zip" -r config boot.3dsx
26+
- name: Publish release archive
27+
uses: softprops/action-gh-release@v1
28+
if: startsWith(github.ref, 'refs/tags/')
29+
with:
30+
files: "./3ds-hbmenu-${{ env.VERSTRING }}.zip"
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.*/
2+
!.github/
23
build/
34
*.t3x
45
*.3dsx

0 commit comments

Comments
 (0)