Skip to content

Commit 18e7bb6

Browse files
committed
ci: add release workflow
1 parent 86f82a1 commit 18e7bb6

File tree

2 files changed

+114
-0
lines changed

2 files changed

+114
-0
lines changed

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: scallop-release
2+
3+
on:
4+
push:
5+
tags: [scallop-*]
6+
workflow_dispatch:
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
outputs:
12+
release: ${{ steps.release.outputs.release }}
13+
version: ${{ steps.release.outputs.version }}
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v6
17+
18+
- name: Get the release name
19+
id: release
20+
run: |
21+
name=$(sed -rn "/^PACKAGE_NAME=/ s/^.*='(.*)'/\1/p" configure)
22+
version=$(sed -rn "/^PACKAGE_VERSION=/ s/^.*='(.*)'/\1/p" configure)
23+
release=${name}-${version}
24+
ref=${{ github.ref_name }}
25+
26+
# verify tag name matches configure script
27+
if [[ ${ref} != main && ${ref} != ${release} ]]; then
28+
echo "tag name ${ref} doesn't match package: ${release}"
29+
exit 1
30+
fi
31+
32+
echo "release=${release}" >> $GITHUB_OUTPUT
33+
echo "version=${version}" >> $GITHUB_OUTPUT
34+
35+
source:
36+
needs: release
37+
runs-on: ubuntu-latest
38+
env:
39+
RELEASE: ${{ needs.release.outputs.release }}
40+
VERSION: ${{ needs.release.outputs.version }}
41+
42+
steps:
43+
- name: Checkout code
44+
uses: actions/checkout@v6
45+
with:
46+
path: bash
47+
48+
- name: Copy release files
49+
run: |
50+
# remove unused files
51+
rm -r bash/{doc,examples,tests,po}
52+
53+
# copy release files
54+
mkdir ${RELEASE}
55+
cp -a bash/* ${RELEASE}
56+
57+
58+
- name: Build and install release
59+
run: |
60+
# copy release files
61+
cp -a ${RELEASE} ${RELEASE}-test
62+
cd ${RELEASE}-test
63+
64+
# configure using required scallop options
65+
./configure-scallop
66+
67+
# build static and shared libraries
68+
make -j libscallop.a libscallop.so
69+
70+
# install shared library and headers
71+
sudo make install-library install-headers
72+
73+
- name: Test release
74+
run: |
75+
# verify shared library is installed and pkg-config works as expected
76+
pkg-config --modversion scallop
77+
pkg-config --exact-version ${VERSION} scallop
78+
79+
- name: Create tarball
80+
run: tar -c -I "xz -9 -T0" -f ${RELEASE}.tar.xz ${RELEASE}
81+
82+
- name: Upload artifact
83+
uses: actions/upload-artifact@v4
84+
with:
85+
name: source
86+
path: ./*.tar.xz
87+
if-no-files-found: error
88+
retention-days: 3
89+
90+
publish:
91+
if: startsWith(github.ref, 'refs/tags/')
92+
needs: source
93+
runs-on: ubuntu-latest
94+
permissions:
95+
contents: write
96+
97+
steps:
98+
- name: Download artifacts
99+
uses: actions/download-artifact@v4
100+
with:
101+
path: artifacts
102+
merge-multiple: true
103+
104+
- name: Create GitHub release
105+
uses: softprops/action-gh-release@v2
106+
with:
107+
files: artifacts/*.tar.xz
108+
fail_on_unmatched_files: true

0 commit comments

Comments
 (0)