Update github actions #11
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: prebuild | |
| permissions: | |
| contents: write | |
| # Run this workflow every time a new commit pushed to your repository | |
| on: [push, pull_request] | |
| jobs: | |
| init: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const releases = await github.rest.repos.listReleases({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| }); | |
| for (const release of releases.data) { | |
| if (release.tag_name === 'prebuilt') { | |
| await github.rest.repos.deleteRelease({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| release_id: release.id, | |
| }); | |
| } | |
| } | |
| try { | |
| await github.rest.git.deleteRef({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| ref: `tags/prebuilt`, | |
| }); | |
| } catch (error) {} | |
| prebuilt: | |
| needs: init | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: windows-latest | |
| name: windows-x86_64 | |
| - os: ubuntu-22.04 | |
| name: linux-x86_64 | |
| - os: macos-15 | |
| name: macos-arm64 | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Installing premake5 | |
| if: runner.os != 'macOS' | |
| uses: Jarod42/install-premake5@v6 | |
| - name: Installing premake5 on macOS | |
| if: runner.os == 'macOS' | |
| run: | | |
| brew install premake | |
| - name: Install rust | |
| uses: dtolnay/rust-toolchain@1.86 | |
| - name: Build | |
| if: runner.os != 'Windows' | |
| run: | | |
| premake5 add --package=https://github.com/sniper00/lrust.git | |
| premake5 build --release | |
| premake5 publish | |
| zip_name=$(ls *.zip) | |
| echo "zip_name=$zip_name" >> $GITHUB_ENV | |
| - name: Build on Windows | |
| if: runner.os == 'Windows' | |
| run: | | |
| premake5 add --package=https://github.com/sniper00/lrust.git | |
| premake5.exe build --release | |
| premake5.exe publish | |
| pwsh -command '$env:zip_name = (Get-ChildItem -Filter *.zip).Name; echo "zip_name=$env:zip_name" >> $env:GITHUB_ENV' | |
| - uses: softprops/action-gh-release@v2 | |
| with: | |
| name: prebuilt | |
| tag_name: prebuilt | |
| fail_on_unmatched_files: true | |
| files: ${{ env.zip_name }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |