Repository navigation
71 lines (63 loc) · 2.56 KB
/
Copy pathswitch.yml
File metadata and controls
71 lines (63 loc) · 2.56 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
# The Nintendo Switch homebrew port (docs/SWITCH.md): ./build.sh switch in the toolchain image that
# port/switch/Containerfile describes. Building that image compiles Mesa's NVK driver and takes hours, so it
# is kept in GitHub's container registry under the tag port/switch/build.sh derives from its inputs: a run
# pulls it, builds it only when the inputs changed, and a push to master publishes the new one.
name: Switch build
on:
push:
branches: [master]
pull_request:
workflow_dispatch:
permissions:
contents: read
packages: write
jobs:
switch:
name: Build Nintendo Switch homebrew
runs-on: ubuntu-26.04
timeout-minutes: 360
env:
REGISTRY_IMAGE: ghcr.io/themoonpeople/chronicle-switch
steps:
- uses: actions/checkout@v7
with:
submodules: true
- name: Log in to the container registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# A pull request from a fork reads the registry but cannot write to it.
- name: Fetch the toolchain image
id: image
run: |
image=$(port/switch/build.sh image)
tag=${image#*:}
echo "tag=$tag" >> "$GITHUB_OUTPUT"
if docker pull "$REGISTRY_IMAGE:$tag"; then
docker tag "$REGISTRY_IMAGE:$tag" "$image"
echo "built=false" >> "$GITHUB_OUTPUT"
else
echo "built=true" >> "$GITHUB_OUTPUT"
fi
- name: Build the Switch NRO
run: ./build.sh switch
- name: Upload the Switch build
uses: actions/upload-artifact@v7
with:
name: chronicle-switch
path: |
port/build/switch/darkcloud.nro
port/build/switch/lang/**
port/build/switch/glyphs/**
if-no-files-found: error
# The registry refuses the push until the chronicle-switch package grants this repository write access
# (package settings, Manage Actions access); the build stands without it and the next run builds the
# image again.
- name: Publish the toolchain image
if: steps.image.outputs.built == 'true' && github.event_name == 'push'
run: |
docker tag "chronicle-switch:${{ steps.image.outputs.tag }}" "$REGISTRY_IMAGE:${{ steps.image.outputs.tag }}"
docker push "$REGISTRY_IMAGE:${{ steps.image.outputs.tag }}" ||
echo "::warning::The registry refused the toolchain image; grant this repository write access to the chronicle-switch package"