switch-tools/.github/workflows/ci.yml
2025-05-02 03:29:09 +03:00

100 lines
2.2 KiB
YAML

name: Build and Release
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
release:
types: [ created ]
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential autoconf automake libtool pkg-config liblz4-dev zlib1g-dev
- name: Configure
run: |
./autogen.sh
./configure
- name: Build
run: make
- name: Create package
run: |
mkdir -p dist/
cp elf2nso elf2nro elf2kip build_pfs0 build_romfs nacptool npdmtool nxlink dist/
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: switch-tools-linux
path: dist/
build-windows:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v3
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >-
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-autotools
autoconf
automake
libtool
make
pkg-config
mingw-w64-x86_64-lz4
mingw-w64-x86_64-zlib
zip
- name: Configure
run: |
./autogen.sh
./configure
- name: Build
run: make
- name: Create package
run: |
mkdir -p dist/
cp *.exe dist/
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: switch-tools-windows
path: dist/
release:
if: github.event_name == 'release'
needs: [build-linux, build-windows]
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v3
- name: Upload to release
uses: softprops/action-gh-release@v1
with:
files: |
switch-tools-linux/switch-tools-linux.zip
switch-tools-windows/switch-tools-windows.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}