Skip to content

Commit

Permalink
Merge pull request #33 from NikRimington/amend/workflow-update
Browse files Browse the repository at this point in the history
Amend/workflow update
  • Loading branch information
NikRimington authored Dec 17, 2023
2 parents 28fafba + 5ae2473 commit 5a8bd5f
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 39 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build and Release Package

# This action will start when a correctly formatted tag is pushed (e.g. v0.1.0)

on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
workflow_dispatch:

jobs:
build:
runs-on: windows-latest

steps:

- name: Set Version Variable
if: ${{ github.ref_type == 'tag' }}
env:
TAG: ${{ github.ref_name }}
run: echo "VERSION=${TAG#v}" >> $GITHUB_ENV

- name: Checkout repository
uses: actions/checkout@v3

- name: Setup .NET 6
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x

- name: Setup .NET 7
uses: actions/setup-dotnet@v2
with:
dotnet-version: 7.0.x

- name: Setup .NET 8
uses: actions/setup-dotnet@v2
with:
dotnet-version: 8.0.x

- name: Build project
run: dotnet build src\HC.PageNotFoundManager\HC.PageNotFoundManager.csproj --configuration Release /p:Version=$VERSION

- name: Pack project
run: dotnet pack --output nupkgs /p:PackageVersion=$VERSION .\src\PageNotFoundManager.sln

- name: upload nuget package
if: github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v')
run: dotnet nuget push **\*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json
50 changes: 50 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build and Release Package

on:
push:
branches: ["develop"]
pull_request:
branches: ["develop"]
workflow_dispatch:

jobs:
build:
runs-on: windows-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Get next version
uses: reecetech/version-increment@2023.9.3
id: version
with:
scheme: semver
increment: patch
release_branch: main

- name: Set Version Variable
env:
TAG: ${{ steps.version.outputs.version }}
run: echo "VERSION=${TAG#v}" >> $GITHUB_ENV

- name: Setup .NET 6
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x

- name: Setup .NET 7
uses: actions/setup-dotnet@v2
with:
dotnet-version: 7.0.x

- name: Setup .NET 8
uses: actions/setup-dotnet@v2
with:
dotnet-version: 8.0.x

- name: Build project
run: dotnet build src\HC.PageNotFoundManager\HC.PageNotFoundManager.csproj --configuration Release /p:Version=$VERSION

- name: Pack project
run: dotnet pack --output nupkgs /p:PackageVersion=$VERSION .\src\PageNotFoundManager.sln
39 changes: 0 additions & 39 deletions .github/workflows/release.yml

This file was deleted.

0 comments on commit 5a8bd5f

Please sign in to comment.