Release:--: v0.0.8_2025-12-18_02:23:17_UTC #7
Workflow file for this run
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_Build | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| UPLOAD_URL: ${{ steps.stepCreateRelease.outputs.upload_url }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Get latest tag | |
| run: | | |
| echo "LATEST_TAG=$(git tag | grep -v '^latest$' | sort -V | tail -n1)" >> $GITHUB_ENV | |
| - name: Bump version and push tag | |
| id: tag-version | |
| uses: mathieudutour/[email protected] | |
| with: | |
| tag_prefix: "" | |
| custom_tag: ${{ env.LATEST_TAG }} | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Check changelog exists | |
| id: check_changelog | |
| run: | | |
| FILE="changelog/${LATEST_TAG}.md" | |
| if [ -f "$FILE" ]; then | |
| echo "exists=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "exists=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Step GitHub release (with changelog) | |
| if: steps.check_changelog.outputs.exists == 'true' | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| skipIfReleaseExists: 'true' | |
| tag: ${{ env.LATEST_TAG }} | |
| name: ${{ env.LATEST_TAG }} | |
| bodyFile: changelog/${{ env.LATEST_TAG }}.md | |
| - name: Step GitHub release (no changelog) | |
| if: steps.check_changelog.outputs.exists != 'true' | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| skipIfReleaseExists: 'true' | |
| tag: ${{ env.LATEST_TAG }} | |
| name: ${{ env.LATEST_TAG }} | |
| Build: | |
| runs-on: ${{ matrix.os }} | |
| needs: release | |
| strategy: | |
| matrix: | |
| os: [macos-latest, windows-latest] | |
| steps: | |
| - name: CheckOut | |
| uses: actions/checkout@v4 | |
| - name: Set APP_VERSION env | |
| if: runner.os == 'Linux' || runner.os == 'macOS' | |
| shell: bash | |
| run: | | |
| echo "APP_VERSION=$(echo ${GITHUB_REF} | rev | cut -d'/' -f 1 | rev)" >> $GITHUB_ENV | |
| - name: Set APP_VERSION env on Windows | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| $ref = "${env:GITHUB_REF}" | |
| $app_version = $ref.Split('/')[-1] | |
| "APP_VERSION=$app_version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '>=1.18.0' | |
| - name: build for macOS GUI and Linux agent | |
| if: runner.os == 'macOS' | |
| run: | | |
| brew install FiloSottile/musl-cross/musl-cross | |
| brew install create-dmg | |
| brew install mingw-w64 | |
| echo "MUSL_CROSS_ROOT=$(brew --prefix musl-cross)" >> $GITHUB_ENV | |
| echo "PATH=${MUSL_CROSS_ROOT}/bin:$PATH" >> $GITHUB_ENV | |
| echo "MINGW_ROOT=$(brew --prefix mingw-w64)" >> $GITHUB_ENV | |
| echo "PATH=${MINGW_ROOT}/bin:$PATH" >> $GITHUB_ENV | |
| cd ./examples | |
| chmod a+x ./build_example.sh | |
| ./build_example.sh | |
| ./build_example.sh test | |
| - name: Install Mesa For Windows | |
| if: runner.os == 'Windows' | |
| uses: f3d-app/install-mesa-windows-action@v2 | |
| with: | |
| path: ${{github.workspace}}/mesa | |
| - name: Set up MSYS2 environment | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: | | |
| Invoke-WebRequest -Uri https://github.com/msys2/msys2-installer/releases/download/2025-02-21/msys2-x86_64-20250221.exe -OutFile msys2-install.exe | |
| .\msys2-install.exe --script --accept-licenses --confirm-command --root C:/msys64 | |
| C:\msys64\usr\bin\bash -lc "pacman -Syu --noconfirm" | |
| C:\msys64\usr\bin\bash -lc "pacman -S --noconfirm base-devel mingw-w64-x86_64-binutils mingw-w64-x86_64-toolchain git mingw-w64-x86_64-cmake" | |
| echo "C:\msys64\mingw64\bin;$env:PATH" | Out-File -Encoding ASCII -Append $env:GITHUB_PATH | |
| - name: Build for Windows | |
| if: runner.os == 'Windows' | |
| shell: bash | |
| run: | | |
| cd ./examples | |
| chmod a+x ./build_example.sh | |
| echo "PATH: $PATH" | |
| which gcc | |
| gcc --version | |
| gcc -print-file-name=opengl32.dll | |
| ./build_example.sh || { echo "Build failed"; cat windres.log magick.log; exit 1; } | |
| ./build_example.sh test || { echo "Test build failed"; cat windres.log magick.log; exit 1; } | |
| ls -l ./build/upload_tmp_dir/\ | |
| - name: Upload examples binaries Linux and windows | |
| id: upload_file_to_release_normal | |
| uses: george012/upload_github_release_assets_action@latest | |
| with: | |
| path: ./examples/build/upload_tmp_dir/*.zip | |
| - name: Upload examples binaries For Mac | |
| id: upload_file_to_release_mac | |
| if: runner.os == 'MacOS' | |
| uses: george012/upload_github_release_assets_action@latest | |
| with: | |
| path: ./examples/build/upload_tmp_dir/*.dmg | |
| RemoveOldRelease: | |
| runs-on: ubuntu-latest | |
| needs: Build | |
| steps: | |
| - name: CheckOut | |
| uses: actions/checkout@v4 | |
| - name: Set APP_VERSION env | |
| run: | | |
| APP_VERSION=$(echo ${GITHUB_REF} | rev | cut -d'/' -f 1 | rev ) \ | |
| function get_pre_del_tag { | |
| local v_str=$1 | |
| baseStr=$(echo $v_str | cut -d'.' -f1) | |
| base=${baseStr//v/} | |
| major=$(echo $v_str | cut -d'.' -f2) | |
| minor=$(echo $v_str | cut -d'.' -f3) | |
| if ((minor>0)); then | |
| minor=$((minor-1)) | |
| else | |
| minor=999 | |
| if ((major>0)); then | |
| major=$((major-1)) | |
| else | |
| major=999 | |
| if ((base>0)); then | |
| base=$((base-1)) | |
| else | |
| echo "Error: Version cannot be decremented." | |
| exit 1 | |
| fi | |
| fi | |
| fi | |
| pre_v_no="v${base}.${major}.${minor}" | |
| echo $pre_v_no | |
| } | |
| APP_OLD_VERSION=$(get_pre_del_tag $(get_pre_del_tag $APP_VERSION)) | |
| echo "Old version to remove: ${APP_OLD_VERSION}" | |
| echo APP_OLD_VERSION=${APP_OLD_VERSION} >> ${GITHUB_ENV} | |
| - name: Remove Old Release | |
| run: | | |
| gh release delete ${{ env.APP_OLD_VERSION }} -y | |
| git push origin --delete ${{ env.APP_OLD_VERSION }} | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |