From 7b63ff360b39e7ecdfc42cacc16c277761d5967f Mon Sep 17 00:00:00 2001 From: Cornelius Wichering Date: Wed, 6 Mar 2024 00:29:11 +0100 Subject: [PATCH] Add github action --- .github/workflows/main.yml | 70 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..f2c09d9 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,70 @@ +name: Create Release and Publish + +on: + push: + tags: + - 'v*' + +jobs: + create-release: + name: Create Release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + releases-matrix: + name: Release Binaries + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - os: ubuntu-latest + files: | + x2h + args: --best --lzma + strip: true + - os: windows-latest + files: | + x2h.exe + args: -9 + strip: false + - os: macos-latest + files: | + x2h + args: --best + strip: true + steps: + - uses: actions/checkout@v4 + - uses: graalvm/setup-graalvm@v1 + with: + java-version: '21' + distribution: 'graalvm' + github-token: ${{ secrets.GITHUB_TOKEN }} + native-image-job-reports: 'true' + - name: Build + run: | + gradle build + native-image --no-fallback -jar build/libs/x2h.jar ${{ matrix.file }} + - name: Compress binaries + uses: svenstaro/upx-action@v2 + with: + files: | + ${{ matrix.file }} + args: ${{ matrix.args }} + strip: ${{ matrix.strip }} + + - name: Upload binary + uses: actions/upload-artifact@v2 + with: + name: x2h-${{ matrix.os }} + path: x2h*