Add pre build shell for windows #4
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
| # This workflow uses actions that are not certified by GitHub. | |
| # They are provided by a third-party and are governed by | |
| # separate terms of service, privacy policy, and support | |
| # documentation. | |
| # This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time | |
| # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle | |
| name: Build Application | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - master | |
| schedule: | |
| - cron: "3 4 */15 * *" # 每两周的午夜触发一次 | |
| concurrency: | |
| group: build-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| architecture: [x64, aarch64] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Pre-build shell for POSIX | |
| if: runner.os != 'Windows' | |
| run: | | |
| ls -al | |
| chmod +x gradlew | |
| ./gradlew --version | |
| - name: Pre-build shell for Windows | |
| if: runner.os == 'Windows' | |
| run: | | |
| ls | |
| .\gradlew.bat --version | |
| - name: Set up GraalVM | |
| uses: graalvm/setup-graalvm@v1 | |
| with: | |
| java-version: '21' | |
| distribution: 'graalvm' | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| components: 'native-image' | |
| - name: Set up Gradle | |
| uses: gradle/gradle-build-action@v2 | |
| with: | |
| gradle-version: '8.8' | |
| - name: Build native image | |
| run: ./gradlew nativeCompile | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: native-image-${{ matrix.os }}-${{ matrix.architecture }} | |
| path: build/native/nativeCompile/SrunLogin* | |
| if-no-files-found: error | |
| release: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: native-image-${{ matrix.os }}-${{ matrix.architecture }} | |
| path: ./artifacts | |
| - name: Create or Update Release | |
| id: create_release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ github.ref }} | |
| name: Release ${{ github.ref }} | |
| draft: false | |
| prerelease: false | |
| files: ./artifacts/native-image-${{ matrix.os }}-${{ matrix.architecture }} | |
| overwrite: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |