Repository navigation
155 lines (139 loc) · 4.43 KB
/
Copy pathrelease.yml
File metadata and controls
155 lines (139 loc) · 4.43 KB
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
version:
description: "Version to release (for example 2.0.0, without the leading v)"
required: true
type: string
permissions:
contents: write
jobs:
prepare:
name: Prepare version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Resolve version
id: version
shell: bash
env:
EVENT_NAME: ${{ github.event_name }}
REF_NAME: ${{ github.ref_name }}
INPUT_VERSION: ${{ inputs.version }}
run: |
set -euo pipefail
if [[ "$EVENT_NAME" == "workflow_dispatch" ]]; then
VERSION="$INPUT_VERSION"
else
VERSION="${REF_NAME#v}"
fi
VERSION="${VERSION#v}"
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Version must use the MAJOR.MINOR.PATCH format, got: $VERSION" >&2
exit 1
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
build:
name: Package ${{ matrix.rid }}
needs: prepare
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
rid: [win-x64, win-arm64, linux-x64, linux-arm64, osx-x64, osx-arm64]
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up .NET 10
uses: actions/setup-dotnet@v6
with:
dotnet-version: 10.0.x
- name: Publish
env:
VERSION: ${{ needs.prepare.outputs.version }}
RID: ${{ matrix.rid }}
run: >
dotnet publish BatchConvertToCompressedFile/BatchConvertToCompressedFile.csproj
-c Release -r "$RID" --self-contained false
-p:PublishSingleFile=true
-p:IncludeNativeLibrariesForSelfExtract=true
-p:DebugType=embedded
-p:Version="$VERSION"
-p:AssemblyVersion="$VERSION.0"
-p:FileVersion="$VERSION.0"
-p:InformationalVersion="$VERSION"
-o "artifacts/$RID"
- name: Add bundle documents
shell: bash
env:
RID: ${{ matrix.rid }}
run: |
set -euo pipefail
find "artifacts/$RID" -maxdepth 1 -type f \( -name '*.xml' -o -name '*.pdb' \) -delete
cp LICENSE ReadMe.md WhatsNew.md "artifacts/$RID/"
ls -la "artifacts/$RID"
- name: Package (.zip for Windows)
if: startsWith(matrix.rid, 'win-')
shell: bash
env:
VERSION: ${{ needs.prepare.outputs.version }}
RID: ${{ matrix.rid }}
run: |
set -euo pipefail
cd "artifacts/$RID"
zip -r "../BatchConvertToCompressedFile_${VERSION}_${RID}.zip" .
cd ..
rm -rf "$RID"
- name: Package (.tar.gz for Linux and macOS)
if: ${{ !startsWith(matrix.rid, 'win-') }}
shell: bash
env:
VERSION: ${{ needs.prepare.outputs.version }}
RID: ${{ matrix.rid }}
run: |
set -euo pipefail
python3 scripts/package-tar.py \
"artifacts/$RID" \
"artifacts/BatchConvertToCompressedFile_${VERSION}_${RID}.tar.gz"
rm -rf "artifacts/$RID"
- name: Upload package
uses: actions/upload-artifact@v7
with:
name: package-${{ matrix.rid }}
path: artifacts/BatchConvertToCompressedFile_*
if-no-files-found: error
release:
name: Create GitHub release
needs: [prepare, build]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Download packages
uses: actions/download-artifact@v8
with:
pattern: package-*
merge-multiple: true
path: artifacts
- name: Generate checksums
working-directory: artifacts
run: sha256sum BatchConvertToCompressedFile_* > checksums.txt
- name: Publish release
uses: softprops/action-gh-release@v3
with:
tag_name: v${{ needs.prepare.outputs.version }}
name: Batch Convert to Compressed File v${{ needs.prepare.outputs.version }}
target_commitish: ${{ github.sha }}
body_path: WhatsNew.md
generate_release_notes: false
fail_on_unmatched_files: true
files: |
artifacts/BatchConvertToCompressedFile_*
artifacts/checksums.txt