From 04ea2863ad2eb5b6fe2c7daab14111dda7589916 Mon Sep 17 00:00:00 2001 From: Kegan Maher Date: Wed, 3 Nov 2021 20:03:30 +0000 Subject: [PATCH 1/4] chore: formatting --- .github/workflows/dotnet-test.yml | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) 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 From 52c5dd3380b37e59c4fd249c87a1e19e638b24e9 Mon Sep 17 00:00:00 2001 From: Kegan Maher Date: Wed, 3 Nov 2021 20:07:26 +0000 Subject: [PATCH 2/4] feat(ci/release): publish release + assets on tag * workflow runs on a tag of the form v*.*.* e.g. v1.2.3 * workflow consists of two jobs: package then release package: * run the dotnet build process using a matrix strategy * generate and zip output * upload zip as GitHub Actions artifact release: * blocked until package finishes successfully * download all GitHub Actions artifacts (from all matrix builds) * make new GitHub Release, attaching all artifacts --- .github/workflows/release.yml | 69 +++++++++++++++++++++++++++++++++++ 1 file changed, 69 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 0000000..f242837 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,69 @@ +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: Zip + run: | + zip -r -j hashfields-${{ matrix.runtime }}-${{ matrix.dotnet }}.zip out/ + ls -l hashfields-${{ matrix.runtime }}-${{ matrix.dotnet }}.zip + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: package + path: hashfields-${{ matrix.runtime }}-${{ matrix.dotnet }}.zip + + 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" From c0688707932193093ba4ea03bf49abdcbc32f5a3 Mon Sep 17 00:00:00 2001 From: Kegan Maher Date: Wed, 3 Nov 2021 20:52:37 +0000 Subject: [PATCH 3/4] feat: add version to artifacts refactor path into a reusable step output --- .github/workflows/release.yml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f242837..5c00b25 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -37,16 +37,27 @@ jobs: - 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.zip" + - name: Zip + env: + path: ${{ steps.make-path.outputs.path }} run: | - zip -r -j hashfields-${{ matrix.runtime }}-${{ matrix.dotnet }}.zip out/ - ls -l hashfields-${{ matrix.runtime }}-${{ matrix.dotnet }}.zip + zip -r -j $path out/ + ls -l $path - name: Upload artifacts uses: actions/upload-artifact@v2 with: name: package - path: hashfields-${{ matrix.runtime }}-${{ matrix.dotnet }}.zip + path: ${{ steps.make-path.outputs.path }} release: runs-on: ubuntu-latest From 8ed6fb803aabc3e731bac2780ca2a9fd1cddf74f Mon Sep 17 00:00:00 2001 From: Kegan Maher Date: Fri, 5 Nov 2021 00:59:56 +0000 Subject: [PATCH 4/4] feat(ci/release): make dotnet version clearer distinct from the app version and the OS runtime --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5c00b25..edf612b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -44,7 +44,7 @@ jobs: runtime: ${{ matrix.runtime }} dotnet: ${{ matrix.dotnet }} run: | - echo "::set-output name=path::hashfields-${ref/refs\/tags\//}-$runtime-$dotnet.zip" + echo "::set-output name=path::hashfields-${ref/refs\/tags\//}-$runtime-dotnet-$dotnet.zip" - name: Zip env: