forked from solvespace/solvespace
-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (51 loc) · 1.63 KB
/
source-tarball.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
name: Source Tarball
on:
release:
types:
- created
jobs:
create_tarball:
name: Create & Upload Tarball
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Pack Tarball
id: pack_tarball
run: |
version="${GITHUB_REF#refs/tags/v}"
dir_name="solvespace-${version}"
archive_name="${dir_name}.tar.xz"
archive_path="${HOME}/${archive_name}"
commit_sha="$GITHUB_SHA"
sed -e 's/^\(include(GetGitCommitHash)\)/#\1/' \
-e 's/^# \(set(GIT_COMMIT_HASH\).*/\1 '"$commit_sha"')/' \
-i CMakeLists.txt
echo "::set-output name=archive_name::${archive_name}"
echo "::set-output name=archive_path::${archive_path}"
cd ..
tar \
--exclude-vcs \
--transform "s:^solvespace:${dir_name}:" \
-cvaf \
${archive_path} \
solvespace
- name: Get Release Upload URL
id: get_upload_url
env:
event: ${{ toJson(github.event) }}
run: |
upload_url=$(echo "$event" | jq -r ".release.upload_url")
echo "::set-output name=upload_url::$upload_url"
echo "Upload URL: $upload_url"
- name: Upload Tarball
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_upload_url.outputs.upload_url }}
asset_path: ${{ steps.pack_tarball.outputs.archive_path }}
asset_name: ${{ steps.pack_tarball.outputs.archive_name }}
asset_content_type: binary/octet-stream