Skip to content

Commit c7e30c8

Browse files
authored
Feature/complete release workflow (#16)
1 parent 423f882 commit c7e30c8

File tree

4 files changed

+63
-10
lines changed

4 files changed

+63
-10
lines changed
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,18 @@ name: Build and deploy ASP.Net Core app to Azure Web App - sample-trigger
66
on:
77
push:
88
branches:
9-
- feature/update-samples-and-documentation
9+
- feature/deploy-sample-project
1010
workflow_dispatch:
1111

1212
jobs:
1313
build:
1414
runs-on: ubuntu-latest
1515

1616
steps:
17-
- uses: actions/checkout@v4
17+
- name: Checkout Repository
18+
uses: actions/checkout@v4
19+
with:
20+
sparse-checkout: samples
1821

1922
- name: Set up .NET Core
2023
uses: actions/setup-dotnet@v1
@@ -31,14 +34,14 @@ jobs:
3134
- name: Upload artifact for deployment job
3235
uses: actions/upload-artifact@v3
3336
with:
34-
name: .net-app
37+
name: sample-app
3538
path: ${{env.DOTNET_ROOT}}/myapp
3639

3740
deploy:
3841
runs-on: ubuntu-latest
3942
needs: build
4043
environment:
41-
name: 'Production'
44+
name: 'Development'
4245
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
4346
permissions:
4447
id-token: write #This is required for requesting the JWT
@@ -47,7 +50,7 @@ jobs:
4750
- name: Download artifact from build job
4851
uses: actions/download-artifact@v3
4952
with:
50-
name: .net-app
53+
name: sample-app
5154

5255
- name: Login to Azure
5356
uses: azure/login@v1

.github/workflows/dotnet-release.yaml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,25 @@ name: Package Release
22
run-name: Release ${{ github.ref_name }}
33

44
on:
5-
release:
6-
types: [published]
5+
push:
6+
tags:
7+
- '[0-1].[0-9]+.[0-9]+' # '0.1.1', '0.14.23'
8+
- '[0-1].[0-9]+.[0-9]+-alpha[0-9]?[0-9]?' # '0.14.23-alpha', '1.14.23-alpha1', '1.14.23-alpha23'
9+
- '[0-1].[0-9]+.[0-9]+-beta[0-9]?[0-9]?' # '0.14.23-beta', '1.14.23-beta1', '1.14.23-beta23'
10+
- '[0-1].[0-9]+.[0-9]+-rc[0-9]?[0-9]?' # '0.14.23-rc', '1.14.23-rc1', '1.14.23-rc23'
711

812
concurrency:
913
group: ${{ github.workflow }}-${{ github.ref }}
1014
cancel-in-progress: true
1115

1216
jobs:
1317
publish_nuget:
14-
if: github.event.release.draft == false
18+
name: Publish NuGet packages
1519
uses: ./.github/workflows/wf-publish-nuget.yaml
20+
permissions:
21+
packages: write
1622
with:
17-
push_package_to_nuget: ${{ github.event.release.prerelease == false }}
23+
push_package_to_nuget: true
24+
version: ${{ github.ref_name }}
1825
secrets:
1926
nuget_api_key: ${{ secrets.NUGET_API_KEY_TEST }}

.github/workflows/wf-publish-nuget.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ on:
1515
description: 'Version Suffix'
1616
type: string
1717
default: ''
18+
version:
19+
description: 'Version'
20+
type: string
21+
default: ''
1822
secrets:
1923
nuget_api_key:
2024
description: 'NuGet API Key'
@@ -39,8 +43,12 @@ jobs:
3943
- name: Create packages directory
4044
run: mkdir -p packages
4145

46+
- name: Define optional Package Version
47+
id: optional_parameter
48+
run: echo "packVersion=${{ inputs.version != '' && format('-p:PackageVersion=''{0}''', github.ref_name) || '' }}" >> $GITHUB_OUTPUT
49+
4250
- name: Pack
43-
run: dotnet pack $GITHUB_WORKSPACE/src/InvvardDev.Ifttt.csproj --version-suffix '${{ inputs.version_suffix }}' --output $PACKAGE_DIR_NAME --configuration ${{ inputs.build_configuration }} -p:GeneratePackageOnBuild=false
51+
run: dotnet pack $GITHUB_WORKSPACE/src/InvvardDev.Ifttt.csproj --version-suffix '${{ inputs.version_suffix }}' --output $PACKAGE_DIR_NAME --configuration ${{ inputs.build_configuration }} -p:GeneratePackageOnBuild=false ${{ steps.optional_parameter.outputs.packVersion }}
4452

4553
- name: Upload Artifact
4654
uses: actions/upload-artifact@v4

.github/workflows/wf-tester.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Workflow Tester
2+
run-name: Workflow Tester
3+
4+
on:
5+
push:
6+
tags:
7+
- '[0-1].[0-9]+.[0-9]+' # '0.1.1', '0.14.23'
8+
- '[0-1].[0-9]+.[0-9]+-alpha[0-9]?[0-9]?' # '0.14.23-alpha', '1.14.23-alpha1', '1.14.23-alpha23'
9+
- '[0-1].[0-9]+.[0-9]+-beta[0-9]?[0-9]?' # '0.14.23-beta', '1.14.23-beta1', '1.14.23-beta23'
10+
- '[0-1].[0-9]+.[0-9]+-rc[0-9]?[0-9]?' # '0.14.23-rc', '1.14.23-rc1', '1.14.23-rc23'
11+
12+
jobs:
13+
test_workflows:
14+
name: Test Workflows
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Output tag name
19+
run: |
20+
echo "Tag name: ${{ github.ref_name }}"
21+
22+
- name: Checkout Repository
23+
uses: actions/checkout@v4
24+
with:
25+
sparse-checkout: src
26+
27+
- name: Create packages directory
28+
run: mkdir -p packages
29+
30+
- name: Define optional Package Version
31+
id: optional_parameter
32+
run: echo "packVersion=${{ contains(github.ref_name, 'alpha') && format('-p:PackageVersion=''{0}''', github.ref_name) || '' }}" >> $GITHUB_OUTPUT
33+
34+
- name: Pack
35+
run: dotnet pack $GITHUB_WORKSPACE/src/InvvardDev.Ifttt.csproj ${{ steps.optional_parameter.outputs.packVersion }}

0 commit comments

Comments
 (0)