Whoops #225
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: Release | |
| on: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Output Project Name | |
| id: project_name | |
| run: | | |
| export NAME="${GITHUB_REPOSITORY#*/}" | |
| echo "name=${NAME}" >> $GITHUB_OUTPUT | |
| - name: Display Project Name | |
| run: | | |
| echo "Building Project '${{ steps.project_name.outputs.name }}'" | |
| # Install Lua and LuaRocks | |
| - name: Install Lua and LuaRocks | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y lua5.1 liblua5.1-0-dev luarocks | |
| # Set up environment for Lua and LuaRocks | |
| - name: Set PATH and environment variables for Lua and LuaRocks | |
| shell: bash | |
| run: | | |
| echo "$HOME/.luarocks/bin" >> $GITHUB_PATH | |
| echo "LUA_PATH=$HOME/.luarocks/share/lua/5.1/?.lua;$HOME/.luarocks/share/lua/5.1/?/init.lua;;" >> $GITHUB_ENV | |
| echo "LUA_CPATH=$HOME/.luarocks/lib/lua/5.1/?.so;;" >> $GITHUB_ENV | |
| - name: Install Lua Packages | |
| run: | | |
| luarocks --local make --dev | |
| - name: Test Project | |
| run: yue -e build.yue src -t | |
| - name: Compile Project | |
| run: yue -e build.yue src -d -y | |
| - name: Fetch latest release of Yuescript .so and .dll | |
| run: | | |
| # Fetch the latest release JSON from GitHub API | |
| curl -s https://api.github.com/repos/pigpigyyy/Yuescript/releases/latest > latest.json | |
| # Extract URLs for yue.so and yue.dll | |
| YUE_SO_URL=$(cat latest.json | jq -r '.assets[] | select(.name | endswith("yue-macos-universal-luajit-so.zip")) | .browser_download_url') | |
| YUE_DLL_URL=$(cat latest.json | jq -r '.assets[] | select(.name | endswith("yue-windows-x64-lua51-dll.7z")) | .browser_download_url') | |
| # Download the files | |
| wget -q $YUE_SO_URL -O yue-macos-universal-luajit-so.zip | |
| wget -q $YUE_DLL_URL -O yue-windows-x64-lua51-dll.7z | |
| # Unzip the files to the src directory | |
| unzip -o yue-macos-universal-luajit-so.zip -d src/ | |
| 7z x yue-windows-x64-lua51-dll.7z -osrc/ | |
| # Remove unneeded files | |
| rm latest.json yue-macos-universal-luajit-so.zip yue-windows-x64-lua51-dll.7z | |
| # Build the applications | |
| - uses: nhartland/love-build@master | |
| with: | |
| app_name: ${{ steps.project_name.outputs.name }} | |
| love_version: "11.5" | |
| - name: Copy yue.so and yue.dll to release directory | |
| run: | | |
| sudo cp src/yue.so release/ | |
| sudo cp src/yue.dll release/ | |
| # Upload the built applications | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: built-applications | |
| path: release |