Skip to content

Commit b420338

Browse files
authored
Merge pull request #216 from AkihiroSuda/cross
CI: Upload static release binaries
2 parents 74bbaf5 + 0bfca81 commit b420338

File tree

2 files changed

+113
-0
lines changed

2 files changed

+113
-0
lines changed

.github/workflows/release.yaml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: Release
2+
on:
3+
push:
4+
tags:
5+
- 'test-cross-*'
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: "Register QEMU to /proc/sys/fs/binfmt_misc"
14+
run: docker run --rm --privileged linuxkit/binfmt:v0.8
15+
- name: "Fetch buildx binary"
16+
run: |
17+
wget -O buildx https://github.com/docker/buildx/releases/download/v0.4.1/buildx-v0.4.1.linux-amd64
18+
chmod +x buildx
19+
- name: "Initialize buildx"
20+
run: |
21+
./buildx create --name cross --platform=amd64,arm,arm64,s390x,ppc64le --use
22+
./buildx inspect --bootstrap
23+
- name: "Build binaries from Dockerfile.cross"
24+
run: ./buildx build -o /tmp --platform=amd64,arm64,arm,s390x,ppc64le -f Dockerfile.cross .
25+
- name: "Create /tmp/artifact"
26+
run: |
27+
mkdir -p /tmp/artifact
28+
mv /tmp/linux_amd64/fuse-overlayfs /tmp/artifact/fuse-overlayfs-x86_64
29+
mv /tmp/linux_arm64/fuse-overlayfs /tmp/artifact/fuse-overlayfs-aarch64
30+
mv /tmp/linux_arm_v7/fuse-overlayfs /tmp/artifact/fuse-overlayfs-armv7l
31+
mv /tmp/linux_s390x/fuse-overlayfs /tmp/artifact/fuse-overlayfs-s390x
32+
mv /tmp/linux_ppc64le/fuse-overlayfs /tmp/artifact/fuse-overlayfs-ppc64le
33+
- name: "SHA256SUMS"
34+
run: (cd /tmp/artifact; sha256sum *) | tee /tmp/SHA256SUMS
35+
- name: "Create release"
36+
uses: actions/create-release@v1
37+
id: create_release
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
with:
41+
tag_name: ${{ github.ref }}
42+
release_name: ${{ github.ref }}
43+
draft: true
44+
- name: "Upload fuse-overlayfs-x86_64"
45+
uses: actions/upload-release-asset@v1.0.2
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
with:
49+
upload_url: ${{ steps.create_release.outputs.upload_url }}
50+
asset_path: /tmp/artifact/fuse-overlayfs-x86_64
51+
asset_name: fuse-overlayfs-x86_64
52+
asset_content_type: application/octet-stream
53+
- name: "Upload fuse-overlayfs-aarch64"
54+
uses: actions/upload-release-asset@v1.0.2
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
with:
58+
upload_url: ${{ steps.create_release.outputs.upload_url }}
59+
asset_path: /tmp/artifact/fuse-overlayfs-aarch64
60+
asset_name: fuse-overlayfs-aarch64
61+
asset_content_type: application/octet-stream
62+
- name: "Upload fuse-overlayfs-armv7l"
63+
uses: actions/upload-release-asset@v1.0.2
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
with:
67+
upload_url: ${{ steps.create_release.outputs.upload_url }}
68+
asset_path: /tmp/artifact/fuse-overlayfs-armv7l
69+
asset_name: fuse-overlayfs-armv7l
70+
asset_content_type: application/octet-stream
71+
- name: "Upload fuse-overlayfs-s390x"
72+
uses: actions/upload-release-asset@v1.0.2
73+
env:
74+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75+
with:
76+
upload_url: ${{ steps.create_release.outputs.upload_url }}
77+
asset_path: /tmp/artifact/fuse-overlayfs-s390x
78+
asset_name: fuse-overlayfs-s390x
79+
asset_content_type: application/octet-stream
80+
- name: "Upload fuse-overlayfs-ppc64le"
81+
uses: actions/upload-release-asset@v1.0.2
82+
env:
83+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84+
with:
85+
upload_url: ${{ steps.create_release.outputs.upload_url }}
86+
asset_path: /tmp/artifact/fuse-overlayfs-ppc64le
87+
asset_name: fuse-overlayfs-ppc64le
88+
asset_content_type: application/octet-stream
89+
- name: "Upload SHA256SUMS"
90+
uses: actions/upload-release-asset@v1.0.2
91+
env:
92+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
93+
with:
94+
upload_url: ${{ steps.create_release.outputs.upload_url }}
95+
asset_path: /tmp/SHA256SUMS
96+
asset_name: SHA256SUMS
97+
asset_content_type: text/plain

Dockerfile.cross

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM --platform=$BUILDPLATFORM debian:10 AS fuse-overlayfs
2+
RUN apt-get update && \
3+
apt-get install --no-install-recommends -y \
4+
git ca-certificates libc6-dev gcc make automake autoconf pkgconf libfuse3-dev file curl
5+
RUN curl -o /cross.sh https://raw.githubusercontent.com/tonistiigi/binfmt/18c3d40ae2e3485e4de5b453e8460d6872b24d6b/binfmt/scripts/cross.sh && chmod +x /cross.sh
6+
COPY . /fuse-overlayfs
7+
WORKDIR /fuse-overlayfs
8+
ARG TARGETPLATFORM
9+
RUN /cross.sh install gcc pkgconf libfuse3-dev | sh
10+
RUN ./autogen.sh && \
11+
CC=$(/cross.sh cross-prefix)-gcc LD=$(/cross.sh cross-prefix)-ld LIBS="-ldl" LDFLAGS="-static" ./configure && \
12+
make && mkdir /out && cp fuse-overlayfs /out && \
13+
file /out/fuse-overlayfs | grep "statically linked"
14+
15+
FROM scratch
16+
COPY --from=fuse-overlayfs /out/fuse-overlayfs /fuse-overlayfs

0 commit comments

Comments
 (0)