-
Notifications
You must be signed in to change notification settings - Fork 0
156 lines (130 loc) · 4.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
name: Release
on:
push:
tags: '*'
env:
MSVC_CONFIG: RelWithDebInfo
jobs:
create_release:
runs-on: ubuntu-24.04
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
git_tag: ${{ steps.get-git-tag.outputs.name }}
steps:
- name: Get Git tag
id: get-git-tag
run: echo "name=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get-git-tag.outputs.name }}
release_name: LOOT Metadata Validator v${{ steps.get-git-tag.outputs.name }}
body: |
Windows users should download the file with the `7z` file extension. It requires Windows 7 or later and the [MSVC 2019 x86 redistributable](https://aka.ms/vs/16/release/vc_redist.x86.exe), and [7-Zip](http://www.7-zip.org/) to extract the archive.
The `metadata-validator.tar.xz` file contains a Linux binary.
linux:
runs-on: ubuntu-24.04
needs: create_release
env:
LIBLOOT_VERSION: 0.24.5
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set libloot install path
run: echo "LIBLOOT_INSTALL_PATH=${{ github.workspace }}/libloot-${{ env.LIBLOOT_VERSION }}-install" >> $GITHUB_ENV
- name: libloot cache
id: libloot-cache
uses: actions/cache@v4
with:
path: ${{ env.LIBLOOT_INSTALL_PATH }}
key: ${{ runner.os }}-libloot-${{ env.LIBLOOT_VERSION }}
- name: Get descriptive version
id: get-version
shell: bash
run: |
GIT_DESCRIBE=$(git describe --tags --long --abbrev=7)
DESC_REF=${GIT_DESCRIBE}_${GITHUB_REF#refs/*/}
SAFE_DESC_REF=${DESC_REF//[\/<>\"|]/_}
echo "version=$SAFE_DESC_REF" >> $GITHUB_OUTPUT
- name: Install APT package dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-upgrade \
cbindgen \
libboost-dev \
libicu-dev \
libtbb-dev
- name: Download and build libloot
run: |
wget https://github.com/loot/libloot/archive/$LIBLOOT_VERSION.tar.gz
tar -xf $LIBLOOT_VERSION.tar.gz
mkdir libloot-$LIBLOOT_VERSION/build
cd libloot-$LIBLOOT_VERSION/build
cmake .. -DLIBLOOT_BUILD_TESTS=OFF -DLIBLOOT_INSTALL_DOCS=OFF -DCMAKE_INSTALL_PREFIX="$LIBLOOT_INSTALL_PATH"
cmake --build . --target loot --config Release
cmake --install . --config Release
if: steps.libloot-cache.outputs.cache-hit != 'true'
- name: Run CMake
run: |
mkdir build
cd build
cmake .. -DCMAKE_PREFIX_PATH="${{ env.LIBLOOT_INSTALL_PATH }}" -DCPACK_PACKAGE_VERSION="${{ steps.get-version.outputs.version }}"
make all
- name: Build archive
id: build-archive
shell: bash
run: |
cd build
cpack
VERSION="${{ steps.get-version.outputs.version }}"
echo "filename=metadata-validator-${VERSION}-Linux.tar.xz" >> $GITHUB_OUTPUT
- name: Upload Archive
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: build/package/${{ steps.build-archive.outputs.filename }}
asset_name: ${{ steps.build-archive.outputs.filename }}
asset_content_type: application/octet-stream
windows:
runs-on: windows-2019
needs: create_release
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get descriptive version
id: get-version
shell: bash
run: |
GIT_DESCRIBE=$(git describe --tags --long --abbrev=7)
DESC_REF=${GIT_DESCRIBE}_${GITHUB_REF#refs/*/}
SAFE_DESC_REF=${DESC_REF//[\/<>\"|]/_}
echo "version=$SAFE_DESC_REF" >> $GITHUB_OUTPUT
- name: Run CMake
run: |
mkdir build
cd build
cmake .. -G "Visual Studio 16 2019" -A Win32 -DCPACK_PACKAGE_VERSION="${{ steps.get-version.outputs.version }}"
cmake --build . --config ${{ env.MSVC_CONFIG }}
- name: Build archive
id: build-archive
shell: bash
run: |
cd build
cpack -C ${{ env.MSVC_CONFIG }}
VERSION="${{ steps.get-version.outputs.version }}"
echo "filename=metadata-validator-${VERSION}-win32.7z" >> $GITHUB_OUTPUT
- name: Upload Archive
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: build/package/${{ steps.build-archive.outputs.filename }}
asset_name: ${{ steps.build-archive.outputs.filename }}
asset_content_type: application/x-7z-compressed