Build #58
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 | |
| on: | |
| push: | |
| paths-ignore: | |
| - '*.md' | |
| - '.gitignore' | |
| - "src/version.h" | |
| - ".github/workflows/delete_old_workflow_runs.yml" | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Release version (SemVer)' | |
| required: true | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| include: | |
| - name: build_x86 | |
| arch: x86 | |
| - name: build_x64 | |
| arch: x64 | |
| - name: build_arm64 | |
| arch: arm64 | |
| name: ${{ matrix.name }} | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: 'true' | |
| - name: Update version.h | |
| shell: bash | |
| run: | | |
| if [ "${{ github.event_name }}" == "push" ]; then | |
| COMMIT_HASH=$(git rev-parse --short HEAD) | |
| VERSION="alpha-${COMMIT_HASH}" | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| sed -i '/#define RELEASE_VER_STR/,/TOSTRING(RELEASE_VER_FIX)/c\#define RELEASE_VER_STR "'$VERSION'"' src/version.h | |
| elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
| VERSION="${{ github.event.inputs.version }}" | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION" | |
| sed -i 's/#define RELEASE_VER_MAIN .*/#define RELEASE_VER_MAIN '$MAJOR'/' src/version.h | |
| sed -i 's/#define RELEASE_VER_SUB .*/#define RELEASE_VER_SUB '$MINOR'/' src/version.h | |
| sed -i 's/#define RELEASE_VER_FIX .*/#define RELEASE_VER_FIX '$PATCH'/' src/version.h | |
| fi | |
| - name: Setup VC-LTL | |
| run: nuget install VC-LTL | |
| - name: Setup YY-Thunks | |
| run: nuget install YY-Thunks | |
| - name: Setup Xmake | |
| uses: xmake-io/github-action-setup-xmake@v1 | |
| - name: Configure Xmake | |
| run: xmake f -a ${{ matrix.arch }} | |
| - name: Build | |
| run: xmake | |
| - name: Upload Separate Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: setdll-${{ matrix.arch }} | |
| path: build/release/* | |
| create_pr: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'workflow_dispatch' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Git Configurations | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git checkout -b release | |
| - name: Update version.h | |
| run: | | |
| VERSION="${{ github.event.inputs.version }}" | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION" | |
| sed -i 's/#define RELEASE_VER_MAIN .*/#define RELEASE_VER_MAIN '"$MAJOR"'/' src/version.h | |
| sed -i 's/#define RELEASE_VER_SUB .*/#define RELEASE_VER_SUB '"$MINOR"'/' src/version.h | |
| sed -i 's/#define RELEASE_VER_FIX .*/#define RELEASE_VER_FIX '"$PATCH"'/' src/version.h | |
| git add src/version.h | |
| git commit -m "build(release): bump version to $VERSION" | |
| git push origin release --force | |
| - name: Create Pull Request | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
| run: | | |
| git push origin release | |
| gh pr create --base main --head release --title "build(release): bump version to ${{ github.event.inputs.version }}" --body "Bump version to ${{ github.event.inputs.version }}" | |
| - name: Output Run ID | |
| run: echo "RUN_ID=${{ github.run_id }}" >> $GITHUB_OUTPUT |