Skip to content

Commit

Permalink
Add GitHub CI (with release archive automation)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
TuxSH committed May 3, 2024
1 parent 6948d3e commit 958c31b
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CI

on:
push: # Note: will run on tags push too
pull_request:
workflow_dispatch: # manual run
workflow_call:
outputs:
VERSTRING:
description: Version string
value: ${{ jobs.build.outputs.VERSTRING }}

jobs:
build:
name: Build boot.3dsx
runs-on: ubuntu-latest
outputs:
VERSTRING: ${{ steps.verstring.outputs.VERSTRING }}
container:
image: devkitpro/devkitarm
options: --user 1001 # runner user, for git safedir
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
submodules: recursive # we currently don't use submodules, but just in case...
fetch-depth: 0 # deep clone (for git describe)
fetch-tags: true
- name: Set version string
id: verstring
run: |
VERSTRING=$(git describe --tags --match "v[0-9]*" --abbrev=7 | sed 's/-[0-9]*-g/-/')
echo "VERSTRING=$VERSTRING" | tee -a $GITHUB_OUTPUT
- name: Build
run: make -j$(nproc --all)
- name: Publish boot.3dsx (only on manual run or release)
if: github.event_name == 'workflow_dispatch' || github.event_name == 'release'
uses: actions/upload-artifact@v4
with:
# This produces a zip with boot.3dsx inside for security reasons
# For publish_release this is presented as boot.3dsx however
name: 3ds-hbmenu-${{ steps.verstring.outputs.VERSTRING }}
path: boot.3dsx
32 changes: 32 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Release CI

on:
release:
types: [published]

jobs:
build:
name: Build boot.3dsx
uses: ./.github/workflows/build.yaml
publish_release:
name: Publish release archive
needs: build
runs-on: ubuntu-latest
env:
VERSTRING: ${{ needs.build.outputs.VERSTRING }}
steps:
- name: Download cacert.pem
run: mkdir -p config/ssl && curl -sSfL "https://curl.se/ca/cacert.pem" -o config/ssl/cacert.pem
- name: Download build artifact from previous job
uses: actions/download-artifact@v4
with:
name: 3ds-hbmenu-${{ env.VERSTRING }}
- name: Bundle release archive
run: zip "3ds-hbmenu-$VERSTRING.zip" -r config boot.3dsx
- name: Publish release archive
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: "./3ds-hbmenu-${{ env.VERSTRING }}.zip"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.*/
!.github/
build/
*.t3x
*.3dsx
Expand Down

0 comments on commit 958c31b

Please sign in to comment.