-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (89 loc) · 2.66 KB
/
release.yml
File metadata and controls
108 lines (89 loc) · 2.66 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
name: release
on:
push:
tags: [scallop-*]
branches: ['**']
paths:
- ".github/workflows/release.yml"
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-latest
outputs:
release: ${{ steps.release.outputs.release }}
version: ${{ steps.release.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Get the release name
id: release
run: |
name=$(sed -rn "/^PACKAGE_NAME=/ s/^.*='(.*)'/\1/p" configure)
version=$(sed -rn "/^PACKAGE_VERSION=/ s/^.*='(.*)'/\1/p" configure)
release=${name}-${version}
ref=${{ github.ref_name }}
# verify tag name matches configure script
if [[ ${{ github.ref_type }} == tag && ${ref} != ${release} ]]; then
echo "tag name ${ref} doesn't match package: ${release}"
exit 1
fi
echo "release=${release}" >> $GITHUB_OUTPUT
echo "version=${version}" >> $GITHUB_OUTPUT
source:
needs: release
runs-on: ubuntu-latest
env:
RELEASE: ${{ needs.release.outputs.release }}
VERSION: ${{ needs.release.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
path: bash
- name: Create release tarball
run: |
# remove unused files
rm -r bash/{doc,examples,tests,po}
# copy non-hidden files
mkdir ${RELEASE}
cp -a bash/* ${RELEASE}
# create tarball
tar -c -I "xz -9 -T0" -f ${RELEASE}.tar.xz ${RELEASE}
- name: Build and install
run: |
cd ${RELEASE}
# configure using required scallop options
./configure-scallop
# build static and shared libraries
make -j libscallop.a libscallop.so
# install shared library and headers
sudo make install-library install-headers
- name: Test
run: |
# verify shared library is installed and pkg-config works as expected
pkg-config --modversion scallop
pkg-config --exact-version ${VERSION} scallop
- name: Upload artifact
uses: actions/upload-artifact@v6
with:
name: source
path: ./*.tar.xz
if-no-files-found: error
retention-days: 3
publish:
if: startsWith(github.ref, 'refs/tags/')
needs: source
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v7
with:
path: artifacts
merge-multiple: true
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
files: artifacts/*.tar.xz
fail_on_unmatched_files: true