Merge from upstream (#104) #346
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
- 'refs/tags/v*' | |
jobs: | |
game: | |
name: Game | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cachix/install-nix-action@v25 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
- uses: cachix/cachix-action@v15 | |
with: | |
name: papermario-dx | |
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' | |
- name: Download base ROM | |
run: | | |
curl -L $BASEROM_US_URL -o papermario.us.z64 | |
nix-store --add-fixed sha256 papermario.us.z64 | |
env: | |
BASEROM_US_URL: ${{ secrets.BASEROM_US_URL }} | |
- name: Cache build and asset directories | |
uses: actions/cache@v4 | |
with: | |
key: ${{ runner.os }}-build-${{ hashFiles('flake.nix') }} | |
path: | | |
ver/us/build | |
assets/us | |
.n2_db | |
.ninja_deps | |
- name: Build shell | |
run: nix develop --command true | |
- name: Configure | |
run: nix develop --command "./configure" | |
- uses: root-project/[email protected] | |
- name: Build game | |
run: nix develop --command "ninja" | |
- name: Build patch file | |
run: nix develop --command ninja ver/us/build/papermario.bps | |
- name: Get repository name | |
id: repo-name | |
uses: MariachiBear/[email protected] | |
with: | |
string-case: paramCase | |
- name: Upload patch as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.repo-name.outputs.repository-name }}.bps | |
path: ver/us/build/papermario.bps | |
prerelease: | |
name: Prerelease | |
runs-on: ubuntu-latest | |
needs: game | |
if: github.ref == 'refs/heads/main' | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get repository name | |
id: repo-name | |
uses: MariachiBear/[email protected] | |
with: | |
string-case: paramCase | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ steps.repo-name.outputs.repository-name }}.bps | |
path: ${{ steps.repo-name.outputs.repository-name }}.bps | |
- uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: "latest" | |
prerelease: true | |
name: Development build | |
files: ${{ steps.repo-name.outputs.repository-name }}.bps | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
needs: game | |
if: github.ref == 'refs/tags/v*' | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get repository name | |
id: repo-name | |
uses: MariachiBear/[email protected] | |
with: | |
string-case: paramCase | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ steps.repo-name.outputs.repository-name }}.bps | |
path: ${{ steps.repo-name.outputs.repository-name }}.bps | |
- uses: softprops/action-gh-release@v2 | |
with: | |
files: ${{ steps.repo-name.outputs.repository-name }}.bps | |
darwin-cachix: | |
name: Build Nix shell for macOS | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cachix/install-nix-action@v25 | |
- uses: cachix/cachix-action@v15 | |
with: | |
name: papermario-dx-aarch64-darwin | |
extraPullNames: papermario-dx | |
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' | |
- name: Download base ROM | |
run: | | |
curl -L $BASEROM_US_URL -o papermario.us.z64 | |
nix-store --add-fixed sha256 papermario.us.z64 | |
env: | |
BASEROM_US_URL: ${{ secrets.BASEROM_US_URL }} | |
- name: Build shell | |
run: nix develop --command true | |
env: | |
NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM: 1 # glibc is marked unsupported on darwin |