-
-
Notifications
You must be signed in to change notification settings - Fork 1
99 lines (94 loc) · 3.3 KB
/
generate-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
on:
workflow_call:
inputs:
package-name:
type: string
description: The package name to analyze
required: true
artifact-name:
type: string
description: The name of the artifact.
default: NuGet
artifacts:
type: string
description: The path to the artifacts.
default: "Artifacts/*.nupkg,Artifacts/*.snupkg"
artifactErrorsFailBuild:
type: boolean
description: Whether to fail the build if there are errors in the artifact.
default: true
generateReleaseNotes:
type: boolean
description: Whether to generate release notes or not.
default: true
zipPath:
type: string
description: The path to the files to zip.
default: ''
jobs:
create-release:
runs-on: ubuntu-latest
env:
DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
permissions:
contents: write
outputs:
version-name: ${{ steps.process-version.outputs.version-name }}
release-display-name: ${{ steps.process-version.outputs.release-display-name }}
is-preview: ${{ steps.process-version.outputs.is-preview }}
steps:
- uses: actions/download-artifact@v4
with:
name: ${{ inputs.artifact-name }}
path: Artifacts/
- name: Zip files
if: ${{ inputs.zipPath != '' }}
run: |
IFS=';' read -ra PATHS <<< "${{ inputs.zipPath }}"
for path in "${PATHS[@]}"; do
path=$(echo "$path" | sed 's/^\.\///')
path=$(echo "$path" | sed 's/\/$//')
path=$(echo "$path" | sed 's/\//\\/g')
if [ ! -e "$path" ]; then
echo "Path $path does not exist"
echo "Contents of $(pwd):"
ls -la
IFS='/' read -ra PARTS <<< "$path"
for i in "${!PARTS[@]}"; do
DIR="${PARTS[@]:0:$i+1}"
DIR=$(echo "$DIR" | sed 's/\\/\\//g')
if [ -e "$DIR" ]; then
echo "Contents of $DIR:"
ls -la "$DIR"
fi
done
continue
fi
echo "Zipping path $path"
cd "$(dirname "$path")"
zip -r "$(basename "$path").zip" "$(basename "$path")"
cd -
done
- name: Process Package Version
shell: bash
id: process-version
working-directory: Artifacts/
run: |
echo "Downloading package version script..."
curl -sS -o process-version.pl https://raw.githubusercontent.com/avantipoint/workflow-templates/master/build/process-version.pl
echo "Finished downloading package version script."
echo "Processing package version..."
perl process-version.pl ${{ inputs.package-name }}
- uses: ncipollo/release-action@main
name: Create Release
with:
artifacts: ${{ inputs.artifacts }}
artifactErrorsFailBuild: ${{ inputs.artifactErrorsFailBuild }}
draft: true
generateReleaseNotes: ${{ inputs.generateReleaseNotes }}
name: ${{ steps.process-version.outputs.release-display-name }}
prerelease: ${{ steps.process-version.outputs.is-preview }}
tag: ${{ steps.process-version.outputs.version-name }}