From afa2edaf4e5c3d805219f109b7b6cfe62e26e972 Mon Sep 17 00:00:00 2001 From: NepuShiro Date: Mon, 1 Jun 2026 14:56:09 -0500 Subject: [PATCH] Remove Web, and enable releases --- .github/workflows/main.yml | 85 ++++++++++++++++++++++++++------------ 1 file changed, 58 insertions(+), 27 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 76aaa10..a96c064 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,6 +1,12 @@ name: Build libsm64 -on: [ push, pull_request ] +on: + push: + branches: + - "**" + tags-ignore: + - "**" + pull_request: jobs: Build: @@ -13,8 +19,6 @@ jobs: os: ubuntu-latest - identifier: windows os: ubuntu-latest - - identifier: web - os: ubuntu-latest runs-on: ${{ matrix.os }} steps: - name: Checkout project @@ -46,16 +50,10 @@ jobs: sudo apt-get update -y -qq sudo apt-get install -y libsdl2-dev libglew-dev - - name: (Web) Set up Emscripten - if: ${{ startsWith(matrix.identifier, 'web') }} - uses: mymindstorm/setup-emsdk@v14 - - name: Build shared library shell: bash run: | - if [[ "${{ matrix.identifier }}" == "web" ]]; then - emmake make lib -j $(nproc) CC=emcc - elif [[ "${{ matrix.identifier }}" == "windows" ]]; then + if [[ "${{ matrix.identifier }}" == "windows" ]]; then make lib -j $(nproc 2>/dev/null || sysctl -n hw.ncpu) \ CC=x86_64-w64-mingw32-gcc \ CXX=x86_64-w64-mingw32-g++ @@ -77,22 +75,55 @@ jobs: ./dist ./run-test - #Release: - # name: "Snapshot Release" - # runs-on: "ubuntu-latest" - # needs: Build + Release: + name: Snapshot Release + runs-on: ubuntu-latest + needs: Build - # steps: - # - name: Download artifacts - # uses: actions/download-artifact@v3 + steps: + - name: Download artifacts + uses: actions/download-artifact@v3 - # - name: Create a Release - # uses: "marvinpinto/action-automatic-releases@latest" - # with: - # repo_token: "${{ secrets.GITHUB_TOKEN }}" - # automatic_release_tag: "latest" - # prerelease: true - # title: "Snapshot Build" - # files: | - # ./README.md - # ./dist \ No newline at end of file + - name: Create release + id: create_release + shell: bash + run: | + RESPONSE=$(curl -s -X POST \ + -H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \ + -H "Content-Type: application/json" \ + "https://git.nepu.men/api/v1/repos/NepuShiro/libsm64/releases" \ + -d '{ + "tag_name": "latest", + "name": "Snapshot Build", + "prerelease": true + }') + + echo "$RESPONSE" + + RELEASE_ID=$(echo "$RESPONSE" | grep -o '"id":[0-9]*' | head -n 1 | grep -o '[0-9]*') + echo "release_id=$RELEASE_ID" >> $GITHUB_OUTPUT + + - name: Upload Linux artifact + shell: bash + run: | + curl -X POST \ + -H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \ + -F "attachment=@libsm64_linux/run-test" \ + "https://git.nepu.men/api/v1/repos/NepuShiro/libsm64/releases/${{ steps.create_release.outputs.release_id }}/assets?name=run-test-linux" + + - name: Upload Windows artifact + shell: bash + run: | + tar -czf windows.tar.gz libsm64_windows + curl -X POST \ + -H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \ + -F "attachment=@windows.tar.gz" \ + "https://git.nepu.men/api/v1/repos/NepuShiro/libsm64/releases/${{ steps.create_release.outputs.release_id }}/assets?name=libsm64-windows.tar.gz" + + - name: Upload README + shell: bash + run: | + curl -X POST \ + -H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \ + -F "attachment=@README.md" \ + "https://git.nepu.men/api/v1/repos/NepuShiro/libsm64/releases/${{ steps.create_release.outputs.release_id }}/assets?name=README.md" \ No newline at end of file