Skip to content

Commit dff81db

Browse files
committed
ci: add a docker workflow
1 parent 6f94dd1 commit dff81db

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed

.github/workflows/docker.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,75 @@ jobs:
6363
password: ${{ secrets.DOCKER_PASSWORD }}
6464
repository: sctg/libtermcap
6565
readme-filepath: ./DOCKER.md
66+
67+
release:
68+
needs: docker
69+
runs-on: ubuntu-latest
70+
permissions:
71+
contents: write
72+
if: startsWith(github.ref, 'refs/tags/v')
73+
74+
steps:
75+
- name: Checkout code
76+
uses: actions/checkout@v6
77+
78+
- name: Extract version from tag
79+
id: version
80+
run: |
81+
VERSION=${GITHUB_REF#refs/tags/v}
82+
echo "version=$VERSION" >> $GITHUB_OUTPUT
83+
84+
- name: Set up QEMU
85+
uses: docker/setup-qemu-action@v3
86+
87+
- name: Log in to Docker Hub
88+
uses: docker/login-action@v3
89+
with:
90+
username: ${{ secrets.DOCKER_USERNAME }}
91+
password: ${{ secrets.DOCKER_PASSWORD }}
92+
93+
- name: Build aarch64 release package
94+
run: |
95+
mkdir -p build-aarch64/libtermcap-${{ steps.version.outputs.version }}-aarch64/lib
96+
mkdir -p build-aarch64/libtermcap-${{ steps.version.outputs.version }}-aarch64/include
97+
mkdir -p build-aarch64/libtermcap-${{ steps.version.outputs.version }}-aarch64/lib/pkgconfig
98+
99+
docker run --platform linux/arm64 --rm \
100+
-v $(pwd)/build-aarch64/libtermcap-${{ steps.version.outputs.version }}-aarch64:/extract \
101+
sctg/libtermcap:musl-${{ steps.version.outputs.version }} \
102+
sh -c "cp /usr/local/lib/libtermcap.a /extract/lib/ && cp /usr/local/include/termcap.h /extract/include/"
103+
104+
cp termcap.pc build-aarch64/libtermcap-${{ steps.version.outputs.version }}-aarch64/lib/pkgconfig/
105+
106+
cd build-aarch64
107+
tar -czf libtermcap-${{ steps.version.outputs.version }}-aarch64.tar.gz \
108+
libtermcap-${{ steps.version.outputs.version }}-aarch64/
109+
cd ..
110+
111+
- name: Build x86_64 release package
112+
run: |
113+
mkdir -p build-x86_64/libtermcap-${{ steps.version.outputs.version }}-x86_64/lib
114+
mkdir -p build-x86_64/libtermcap-${{ steps.version.outputs.version }}-x86_64/include
115+
mkdir -p build-x86_64/libtermcap-${{ steps.version.outputs.version }}-x86_64/lib/pkgconfig
116+
117+
docker run --platform linux/amd64 --rm \
118+
-v $(pwd)/build-x86_64/libtermcap-${{ steps.version.outputs.version }}-x86_64:/extract \
119+
sctg/libtermcap:musl-${{ steps.version.outputs.version }} \
120+
sh -c "cp /usr/local/lib/libtermcap.a /extract/lib/ && cp /usr/local/include/termcap.h /extract/include/"
121+
122+
cp termcap.pc build-x86_64/libtermcap-${{ steps.version.outputs.version }}-x86_64/lib/pkgconfig/
123+
124+
cd build-x86_64
125+
tar -czf libtermcap-${{ steps.version.outputs.version }}-x86_64.tar.gz \
126+
libtermcap-${{ steps.version.outputs.version }}-x86_64/
127+
cd ..
128+
129+
- name: Create Release
130+
run: |
131+
gh release create v${{ steps.version.outputs.version }} \
132+
--title "Release v${{ steps.version.outputs.version }}" \
133+
--draft=false \
134+
build-aarch64/libtermcap-${{ steps.version.outputs.version }}-aarch64.tar.gz \
135+
build-x86_64/libtermcap-${{ steps.version.outputs.version }}-x86_64.tar.gz
136+
env:
137+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

termcap.pc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
prefix=/usr/local
2+
exec_prefix=${prefix}
3+
libdir=${exec_prefix}/lib
4+
includedir=${prefix}/include
5+
6+
Name: termcap
7+
Description: GNU termcap library - Terminal capability database library
8+
Version: 1.3.2
9+
Libs: -L${libdir} -ltermcap
10+
Cflags: -I${includedir}

0 commit comments

Comments
 (0)