Skip to content

Commit a5770bc

Browse files
authored
Update dotnetcore.yml
1 parent 747c2e7 commit a5770bc

File tree

1 file changed

+32
-3
lines changed

1 file changed

+32
-3
lines changed

.github/workflows/dotnetcore.yml

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# The following workflow provides an opinionated template you can customize for your own needs.
2+
#
3+
# To configure Octopus, set the OCTOPUS_API_TOKEN secret to the Octopus API key, and
4+
# set the OCTOPUS_SERVER_URL secret to the Octopus URL.
5+
#
6+
# Double check the "project" and "deploy_to" properties in the "Create Octopus Release" step
7+
# match your Octopus projects and environments.
8+
#
9+
# Get a trial Octopus instance from https://octopus.com/start
10+
111
jobs:
212
build:
313
runs-on: ubuntu-latest
@@ -16,6 +26,8 @@ jobs:
1626
- id: determine_version
1727
name: Determine Version
1828
uses: gittools/actions/gitversion/execute@v0.9.7
29+
with:
30+
additionalArguments: /overrideconfig mode=Mainline
1931
- name: Install Octopus Deploy CLI
2032
uses: OctopusDeploy/install-octocli@v1.1.1
2133
with:
@@ -51,10 +63,10 @@ jobs:
5163
reporter: dotnet-trx
5264
fail-on-error: 'false'
5365
- name: Publish
54-
run: dotnet publish --configuration Release /p:AssemblyVersion=${{ steps.determine_version.outputs.semVer }}
66+
run: dotnet publish --configuration Release /p:AssemblyVersion=${{ steps.determine_version.outputs.assemblySemVer }}
5567
- id: package
5668
name: Package
57-
run: |-
69+
run: |
5870
# Find the publish directories
5971
shopt -s globstar
6072
paths=()
@@ -69,6 +81,7 @@ jobs:
6981
done
7082
# For each publish dir, create a package
7183
packages=()
84+
versions=()
7285
for path in "${uniquepaths[@]}"; do
7386
# Get the directory name four deep, which is typically the project folder
7487
dir=${path}/../../../..
@@ -82,6 +95,7 @@ jobs:
8295
--format zip \
8396
--overwrite
8497
packages=(${packages[@]} "${projectname}.${{ steps.determine_version.outputs.semVer }}.zip")
98+
versions=(${versions[@]} "${projectname}:${{ steps.determine_version.outputs.semVer }}")
8599
done
86100
# Join the array with commas
87101
printf -v joined "%s," "${packages[@]}"
@@ -94,21 +108,34 @@ jobs:
94108
joinednewline="${joinednewline//'%'/'%25'}"
95109
joinednewline="${joinednewline//$'\n'/'%0A'}"
96110
joinednewline="${joinednewline//$'\r'/'%0D'}"
111+
# Now build a new line separated list of versions
112+
printf -v versionsjoinednewline "%s\n" "${versions[@]}"
113+
versionsjoinednewline="${versionsjoinednewline//'%'/'%25'}"
114+
versionsjoinednewline="${versionsjoinednewline//$'\n'/'%0A'}"
115+
versionsjoinednewline="${versionsjoinednewline//$'\r'/'%0D'}"
97116
# Save the list of packages newline separated as an output variable
98117
echo "::set-output name=artifacts_new_line::${joinednewline%\n}"
118+
echo "::set-output name=versions_new_line::${versionsjoinednewline%\n}"
119+
- name: Tag Release
120+
uses: mathieudutour/github-tag-action@v6.0
121+
with:
122+
custom_tag: ${{ steps.determine_version.outputs.semVer }}
123+
github_token: ${{ secrets.GITHUB_TOKEN }}
99124
- name: Create Release
100125
uses: softprops/action-gh-release@v1
101126
with:
102127
files: ${{ steps.package.outputs.artifacts_new_line }}
103-
tag_name: ${{ steps.determine_version.outputs.semVer }}.${{ github.run_number }}
128+
tag_name: ${{ steps.determine_version.outputs.semVer }}+run${{ github.run_number }}-attempt${{ github.run_attempt }}
104129
draft: 'false'
105130
prerelease: 'false'
131+
target_commitish: ${{ github.sha }}
106132
- name: Push to Octopus
107133
uses: OctopusDeploy/push-package-action@v1.1.1
108134
with:
109135
api_key: ${{ secrets.OCTOPUS_API_TOKEN }}
110136
packages: ${{ steps.package.outputs.artifacts }}
111137
server: ${{ secrets.OCTOPUS_SERVER_URL }}
138+
overwrite_mode: OverwriteExisting
112139
- name: Generate Octopus Deploy build information
113140
uses: xo-energy/action-octopus-build-information@v1.1.2
114141
with:
@@ -117,6 +144,7 @@ jobs:
117144
octopus_server: ${{ secrets.OCTOPUS_SERVER_URL }}
118145
push_version: ${{ steps.determine_version.outputs.semVer }}
119146
push_package_ids: RandomQuotes
147+
push_overwrite_mode: OverwriteExisting
120148
output_path: octopus
121149
- name: Create Octopus Release
122150
uses: OctopusDeploy/create-release-action@v1.1.1
@@ -125,6 +153,7 @@ jobs:
125153
project: RandomQuotes
126154
server: ${{ secrets.OCTOPUS_SERVER_URL }}
127155
deploy_to: Development
156+
packages: ${{ steps.package.outputs.versions_new_line }}
128157
name: DotNET Core Build
129158
'on':
130159
workflow_dispatch: {}

0 commit comments

Comments
 (0)