Skip to content

Commit

Permalink
Workflow: package and release on tag #8
Browse files Browse the repository at this point in the history
  • Loading branch information
thekaveman authored Nov 5, 2021
2 parents 219d308 + 8ed6fb8 commit 2852c50
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 13 deletions.
29 changes: 16 additions & 13 deletions .github/workflows/dotnet-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
80 changes: 80 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 2852c50

Please sign in to comment.