From bc2954500ac9e863b4ed830ad4c802c9bfc86a9a Mon Sep 17 00:00:00 2001 From: Jason Dove Date: Wed, 10 Feb 2021 16:53:07 -0600 Subject: [PATCH] add release workflow --- .github/workflows/release.yml | 59 +++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..90a7895f4 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,59 @@ +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: maxOS + os: macos-latest + target: osx-x64 + runs-on: ${{ matrix.os }} + steps: + - name: Get the sources + uses: actions/checkout@v2 + + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 5.0.x + + - name: Install dependencies + run: dotnet restore + + - name: Build + shell: bash + run: | + # Define some variables for things we need + tag=$(git describe --tags --abbrev=0) + release_name="ErsatzTV-$tag-${{ matrix.target }}" + + # Build everything + dotnet publish src/ErsatzTV/ErsatzTV.csproj --framework net50 --runtime "${{ matrix.target }}" -c Release -o "$release_name" + + # Pack files + if [ "${{ matrix.target }}" == "win-x64" ]; then + 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: "ErsatzTV*" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}