forked from Exiv2/exiv2
-
Notifications
You must be signed in to change notification settings - Fork 0
227 lines (195 loc) · 6.99 KB
/
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
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
name: Release
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+
schedule:
- cron: '30 4 * * *'
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name for release'
required: false
default: nightly
jobs:
Linux:
name: 'Build Linux Release'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt install -y gettext doxygen graphviz ninja-build
python -m pip install conan==1.*
- name: Conan common config
run: |
conan profile new --detect default
conan profile update settings.build_type=Release default
conan profile update settings.compiler.libcxx=libstdc++11 default
- name: Run Conan
run: |
mkdir build && cd build
conan profile list
conan profile show default
conan install .. -o webready=False --build missing
- name: Build packaged release
run: |
cmake --preset linux-all -S . -B build -DEXIV2_TEAM_PACKAGING=ON -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DEXIV2_ENABLE_WEBREADY=OFF -DEXIV2_ENABLE_CURL=OFF -DEXIV2_BUILD_SAMPLES=OFF
cmake --build build -t doc
cmake --build build -t package
- uses: actions/upload-artifact@v4
with:
name: exiv2-linux64
path: ./build/exiv2-*.tar.gz
if-no-files-found: error
retention-days: 1
macOS:
name: 'Build macOS Release'
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
brew install ninja
brew install inih
brew install tree
brew install gettext
brew install doxygen
brew install graphviz
- name: Build packaged release
run: |
mkdir build
cmake -GNinja -S . -B build \
-DEXIV2_TEAM_PACKAGING=ON \
-DBUILD_SHARED_LIBS=ON \
-DEXIV2_ENABLE_WEBREADY=OFF \
-DEXIV2_ENABLE_NLS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DEXIV2_ENABLE_BMFF=ON \
-DEXIV2_TEAM_WARNINGS_AS_ERRORS=ON \
-DEXIV2_BUILD_DOC=ON \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON
cmake --build build -t doc
cmake --build build -t package
- uses: actions/upload-artifact@v4
with:
name: exiv2-macos
path: ./build/exiv2-*.tar.gz
if-no-files-found: error
retention-days: 1
Windows:
name: 'Build Windows Release'
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- name: Set up Visual Studio shell
uses: ilammy/msvc-dev-cmd@v1
- name: Install doxygen
run: |
choco install doxygen.install
choco install graphviz
- name: Restore conan cache
uses: actions/cache@v4
with:
path: ${{github.workspace}}/conanCache
key: ${{runner.os}}-release-win-${{ hashFiles('conanfile.py') }}
- name: Install Conan & Common config
run: |
python -m pip install conan==1.*
conan profile new --detect default
conan profile show default
conan profile update settings.build_type=Release default
conan profile update settings.compiler="Visual Studio" default
conan profile update settings.compiler.version=17 default
conan config set storage.path=$Env:GITHUB_WORKSPACE/conanCache
- name: Run Conan
run: |
md build
cd build
conan install .. --build missing
- name: Build packaged release
run: |
cmake --preset win-release -S . -B build -DEXIV2_TEAM_PACKAGING=ON -DEXIV2_BUILD_DOC=ON -DEXIV2_ENABLE_WEBREADY=OFF -DEXIV2_ENABLE_CURL=OFF -DEXIV2_BUILD_SAMPLES=OFF
cmake --build build --parallel -t doc
cmake --build build --parallel -t package
- uses: actions/upload-artifact@v4
with:
name: exiv2-win
path: ./build/exiv2-*.zip
if-no-files-found: error
retention-days: 1
publish:
needs: [Linux, macOS, Windows]
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- if: github.event_name == 'workflow_dispatch'
run: echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
- if: github.event_name == 'schedule'
run: echo 'TAG_NAME=nightly' >> $GITHUB_ENV
- if: github.event_name == 'push'
run: |
TAG_NAME=${{ github.ref }}
echo "TAG_NAME=${TAG_NAME#refs/tags/}" >> $GITHUB_ENV
- if: env.TAG_NAME == 'nightly'
run: |
echo 'BODY<<EOF' >> $GITHUB_ENV
echo '## Exiv2 nightly prerelease build.' >> $GITHUB_ENV
echo 'Please help us improve exiv2 by reporting any issues you encounter :wink:' >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- if: env.TAG_NAME != 'nightly'
run: |
echo 'BODY<<EOF' >> $GITHUB_ENV
echo '## Exiv2 Release ${{ env.TAG_NAME }}' >> $GITHUB_ENV
echo 'See [ChangeLog](doc/ChangeLog) for more information about the changes in this release.' >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Cleanup old nightly
if: env.TAG_NAME == 'nightly'
uses: actions/github-script@v7
with:
script: |
try{
const rel_id = await github.rest.repos.getReleaseByTag({
...context.repo,
tag: "nightly"
}).then(result => result.data.id);
console.log( "Found existing nightly release with id: ", rel_id);
await github.rest.repos.deleteRelease({
...context.repo,
release_id: rel_id
});
console.log( "Deletion of release successful")
}catch(error){
console.log( "Deletion of release failed");
console.log( "Failed with error\n", error);
}
try{
await github.rest.git.deleteRef({
...context.repo,
ref: "tags/nightly"
});
console.log( "Deletion of tag successful")
}catch(error){
console.log( "Deletion of tag failed");
console.log( "Failed with error\n", error);
}
- uses: actions/download-artifact@v4
- name: List downloaded files
run: tree -L 3
- uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# needs newer relase, but add it once available
#fail_on_unmatched_files: true
body: ${{ env.BODY }}
prerelease: ${{ env.TAG_NAME == 'nightly' }}
tag_name: ${{ env.TAG_NAME }}
files: |
./exiv2-linux64/exiv2-*
./exiv2-macos/exiv2-*
./exiv2-win/exiv2-*