From 0551da67150207616faca030ea41bfd13c74258f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Stul=C3=ADk?= Date: Fri, 31 May 2024 20:43:18 +0200 Subject: [PATCH] Github actions, build and publish --- .github/workflows/{dotnet.yml => build.yml} | 0 .github/workflows/publish.yml | 58 +++++++++++++++++++++ 2 files changed, 58 insertions(+) rename .github/workflows/{dotnet.yml => build.yml} (100%) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/dotnet.yml b/.github/workflows/build.yml similarity index 100% rename from .github/workflows/dotnet.yml rename to .github/workflows/build.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..70454fa --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,58 @@ +name: Publish + +on: + release: + types: [published] + +jobs: + release: + name: Release + strategy: + matrix: + kind: ['linux', 'windows', 'macOS'] + include: + - kind: linux + os: ubuntu-latest + target: linux-x64 + - kind: windows + os: windows-latest + target: win-x64 + - kind: macOS + os: macos-latest + target: osx-x64 + runs-on: ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@v1 + + - name: Setup dotnet + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 8.0.x + + - name: Build + shell: bash + run: | + tag=$(git describe --tags --abbrev=0) + release_name="wcc-$tag-${{ matrix.target }}" + + # Build everything + dotnet publish --runtime "${{ matrix.target }}" -c Release -o "$release_name" + + # Pack files + if [ "${{ matrix.target }}" == "win-x64" ]; then + # Pack to zip for Windows + 7z a -tzip "${release_name}.zip" "./${release_name}/*" + else + tar czvf "${release_name}.tar.gz" "$release_name" + fi + + # Delete output directory + rm -r "$release_name" + + - name: Publish + uses: softprops/action-gh-release@v1 + with: + files: "wcc*" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file