|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: ['v*'] |
| 6 | + |
| 7 | +permissions: |
| 8 | + contents: write |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + include: |
| 15 | + - arch: amd64 |
| 16 | + platform: linux/amd64 |
| 17 | + - arch: arm64 |
| 18 | + platform: linux/arm64 |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v4 |
| 22 | + with: |
| 23 | + fetch-depth: 0 |
| 24 | + |
| 25 | + - name: Set up QEMU |
| 26 | + if: matrix.arch == 'arm64' |
| 27 | + uses: docker/setup-qemu-action@v3 |
| 28 | + |
| 29 | + - name: Build static binary |
| 30 | + run: | |
| 31 | + VERSION="${GITHUB_REF_NAME#v}" |
| 32 | + docker run --rm --platform ${{ matrix.platform }} \ |
| 33 | + -v "$PWD:/src" -w /src alpine:3.21 sh -c " |
| 34 | + apk add --no-cache build-base openssl-dev openssl-libs-static zlib-dev zlib-static linux-headers git |
| 35 | + git config --global --add safe.directory /src |
| 36 | + make clean |
| 37 | + make -j\$(nproc) EXTRA_VERSION=${VERSION} EXTRA_LDFLAGS='-static' |
| 38 | + " |
| 39 | +
|
| 40 | + - name: Verify static linking |
| 41 | + run: | |
| 42 | + file objs/bin/mtproto-proxy | tee /dev/stderr | grep -q "statically linked" |
| 43 | +
|
| 44 | + - name: Upload artifact |
| 45 | + uses: actions/upload-artifact@v4 |
| 46 | + with: |
| 47 | + name: mtproto-proxy-linux-${{ matrix.arch }} |
| 48 | + path: objs/bin/mtproto-proxy |
| 49 | + |
| 50 | + release: |
| 51 | + needs: build |
| 52 | + runs-on: ubuntu-latest |
| 53 | + steps: |
| 54 | + - uses: actions/checkout@v4 |
| 55 | + |
| 56 | + - uses: actions/download-artifact@v4 |
| 57 | + with: |
| 58 | + path: artifacts |
| 59 | + |
| 60 | + - name: Prepare release assets |
| 61 | + run: | |
| 62 | + mkdir -p release |
| 63 | + cp artifacts/mtproto-proxy-linux-amd64/mtproto-proxy release/mtproto-proxy-linux-amd64 |
| 64 | + cp artifacts/mtproto-proxy-linux-arm64/mtproto-proxy release/mtproto-proxy-linux-arm64 |
| 65 | + chmod +x release/mtproto-proxy-linux-* |
| 66 | + cd release |
| 67 | + sha256sum mtproto-proxy-linux-* > SHA256SUMS |
| 68 | +
|
| 69 | + - name: Create GitHub Release |
| 70 | + uses: softprops/action-gh-release@v2 |
| 71 | + with: |
| 72 | + files: release/* |
| 73 | + generate_release_notes: true |
0 commit comments