Build jobs #29
This file contains hidden or 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 jobs | |
| on: | |
| workflow_call: | |
| workflow_dispatch: | |
| push: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| container: devkitpro/devkita64 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-tags: true | |
| path: sys-patch | |
| submodules: recursive | |
| - name: deps - libnx | |
| run: | | |
| git clone https://github.com/switchbrew/libnx.git /tmp/libnx | |
| make -C /tmp/libnx install -j4 | |
| - name: Build sys-patch | |
| run: | | |
| make -C sys-patch -j$(nproc) dist && \ | |
| VERSION=$(grep 'export VERSION := ' sys-patch/Makefile | cut -c 19-) | |
| TAGVERSION=$(curl -s https://api.github.com/repos/$GITHUB_REPOSITORY/releases/latest | grep "tag_name" | head -1 | cut -d '"' -f 4) | |
| echo "VERSION=${VERSION}" >> $GITHUB_ENV | |
| echo "TAGVERSION=${TAGVERSION}" >> $GITHUB_ENV | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| include-hidden-files: true | |
| overwrite: true | |
| name: sys-patch-${{ env.VERSION }} | |
| path: sys-patch/out/ | |
| - name: Fetch git cli and upload release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| if [ ${{ env.TAGVERSION }} = v${{ env.VERSION }} ]; | |
| then echo "Tag version and makefile version are same, don't publish release, only artifact uploaded." | |
| else | |
| wget -q $(curl -s https://api.github.com/repos/cli/cli/releases/latest | grep "browser_download_url" | grep "linux_amd64.tar.gz" | head -1 | cut -d '"' -f 4) && \ | |
| tar -xzf gh*.tar.gz && \ | |
| chmod +x gh*/bin/gh && \ | |
| chmod +x gh*/bin/gh && \ | |
| cp gh*/bin/gh /bin/gh && \ | |
| rm gh*.tar.gz && \ | |
| rm -rf gh* | |
| gh release create v${{ env.VERSION }} sys-patch/sys-patch.zip --title "Sys-patch version ${{ env.VERSION }}" --repo github.com/$GITHUB_REPOSITORY | |
| fi |