diff --git a/.github/workflows/dotnet-test.yml b/.github/workflows/dotnet-test.yml index 6df6269..92542e3 100644 --- a/.github/workflows/dotnet-test.yml +++ b/.github/workflows/dotnet-test.yml @@ -8,18 +8,21 @@ on: jobs: test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Setup .NET - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 5.0.x - - name: Restore dependencies - run: dotnet restore - - name: Build - run: dotnet build --no-restore - - name: Test - run: dotnet test --no-build --verbosity normal + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup .NET + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 5.0.x + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: dotnet build --no-restore + + - name: Test + run: dotnet test --no-build --verbosity normal diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..edf612b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,80 @@ +name: Publish release + +on: + push: + tags: [ "v*.*.*" ] + +jobs: + package: + runs-on: ubuntu-latest + + strategy: + matrix: + dotnet: [5.0.x] + runtime: [linux-x64, win10-x64, osx.11.0-x64] + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install tooling + run: sudo apt-get install -qq zip + + - name: Setup .NET + uses: actions/setup-dotnet@v1 + with: + dotnet-version: ${{ matrix.dotnet }} + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: dotnet build --no-restore + + - name: Test + run: dotnet test --no-build --verbosity normal + + - name: Publish + run: dotnet publish -r ${{ matrix.runtime }} -c Release -o ./out src/Cli/hashfields.csproj + + - name: Make artifact path + id: make-path + env: + ref: ${{ github.ref }} + runtime: ${{ matrix.runtime }} + dotnet: ${{ matrix.dotnet }} + run: | + echo "::set-output name=path::hashfields-${ref/refs\/tags\//}-$runtime-dotnet-$dotnet.zip" + + - name: Zip + env: + path: ${{ steps.make-path.outputs.path }} + run: | + zip -r -j $path out/ + ls -l $path + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: package + path: ${{ steps.make-path.outputs.path }} + + release: + runs-on: ubuntu-latest + + needs: package + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Download artifacts + uses: actions/download-artifact@v2 + with: + name: package + path: ./package + + - name: Release + uses: softprops/action-gh-release@v1 + with: + files: "./package/*.zip"