-
-
Notifications
You must be signed in to change notification settings - Fork 229
84 lines (76 loc) · 2.61 KB
/
release_archives.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
# Copyright 2023 René Ferdinand Rivera Morell
# Use, modification, and distribution are subject to the
# Boost Software License, Version 1.0. (See accompanying file LICENSE.txt)
name: "Release: Archives"
on:
# Allow manual runs.
workflow_dispatch:
# Run on publishing of releases.
release: { types: [published] }
# And run on pushes, for main and release branches.
push:
branches: ["main", "release", "version/*"]
paths-ignore:
[
".circleci/**",
".cirrus.yml",
".drone.star",
".semaphore/**",
".travis.yml",
"appveyor.yml",
"azure-pipelines.yml",
".ci/azp-*.yml",
]
jobs:
archive:
strategy:
matrix:
include:
- { name: "Zip", format: "zip", command: "zip -r -9" }
- {
name: "7z",
format: "7z",
command: "7za a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on",
}
- { name: "BZip2", format: "tar.bz2", command: "tar -cv -j -f" }
# - { name: "Zstd", format: "tar.zstd", command: "tar -cv --zstd -f" }
runs-on: ubuntu-latest
name: ${{ matrix.name }}
steps:
- name: "Checkout"
uses: actions/checkout@main
with: { path: "b2" }
- name: "Snapshot"
run: |
cd "${{github.workspace}}/b2"
version=`basename ${{github.ref_name}}`
git archive --format=tar --output="${{github.workspace}}/b2-${version}.tar" "${{github.ref_name}}"
cd "${{github.workspace}}"
mkdir "b2-${version}"
cd "b2-${version}"
tar -xvf "${{github.workspace}}/b2-${version}.tar"
rm -rf "${{github.workspace}}/b2-${version}.tar"
cd "${{github.workspace}}"
ls -laF
- name: "Archive"
run: |
cd "${{github.workspace}}"
version=`basename ${{github.ref_name}}`
archive="${{github.workspace}}/b2-${version}.${{matrix.format}}"
${{matrix.command}} "${archive}" "b2-${version}"
sha256sum -b "${archive}" > "${archive}.sha256sum.txt"
- name: "Cleanup"
run: |
cd "${{github.workspace}}"
version=`basename ${{github.ref_name}}`
rm -rf "${{github.workspace}}/b2-${version}"
- name: "Upload"
uses: actions/upload-artifact@main
with:
name: B2-${{matrix.name}}
path: "${{github.workspace}}/b2-*"
- name: "Publish"
uses: softprops/action-gh-release@master
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
with:
files: "${{github.workspace}}/b2-*"