|
1 | 1 | name: Publish |
2 | 2 | on: |
| 3 | + pull_request: |
3 | 4 | push: |
| 5 | + branches: |
| 6 | + - '*' |
4 | 7 | tags: |
5 | 8 | - '*' |
6 | 9 |
|
7 | 10 | jobs: |
8 | | - build: |
9 | | - name: Publish tarballs |
| 11 | + build_tarballs: |
| 12 | + name: Build tarballs |
10 | 13 | runs-on: ubuntu-latest |
11 | 14 | steps: |
12 | 15 | - name: Checkout |
|
17 | 20 | nix-build -A hydraJobs.tarball |
18 | 21 | install -D ./result/tarballs/*.tar.bz2 ./dist/patchelf-$(cat version).tar.bz2 |
19 | 22 | install -D ./result/tarballs/*.tar.gz ./dist/patchelf-$(cat version).tar.gz |
| 23 | + - uses: actions/upload-artifact@v2 |
| 24 | + with: |
| 25 | + name: patchelf |
| 26 | + path: dist/* |
| 27 | + |
| 28 | + build_binaries: |
| 29 | + name: Build static musl binaries |
| 30 | + needs: [build_tarballs] |
| 31 | + runs-on: ubuntu-latest |
| 32 | + strategy: |
| 33 | + fail-fast: false |
| 34 | + matrix: |
| 35 | + platform: ["amd64", "i386", "ppc64le", "arm64v8", "arm32v7", "s390x"] |
| 36 | + steps: |
| 37 | + - name: Set up QEMU |
| 38 | + if: matrix.platform != 'amd64' |
| 39 | + uses: docker/setup-qemu-action@v1 |
| 40 | + |
| 41 | + - uses: actions/download-artifact@v2 |
| 42 | + with: |
| 43 | + name: patchelf |
| 44 | + path: dist |
| 45 | + - name: Build binaries |
| 46 | + env: |
| 47 | + CXXFLAGS: "-D_FORTIFY_SOURCE=2 -fstack-protector-strong -Wformat -Werror=format-security -O2 -static" |
| 48 | + run: | |
| 49 | + cat <<EOF > build.sh |
| 50 | + set -e |
| 51 | + set -x |
| 52 | + apk add build-base |
| 53 | + tar -xf dist/*.tar.bz2 |
| 54 | + rm -f dist/* |
| 55 | + cd patchelf-* |
| 56 | + ./configure --prefix /patchelf |
| 57 | + make check |
| 58 | + make install-strip |
| 59 | + cd - |
| 60 | + tar -czf ./dist/patchelf-\$(cat patchelf-*/version)-\$(uname -m).tar.gz -C /patchelf . |
| 61 | + EOF |
| 62 | +
|
| 63 | + if [ "${{ matrix.platform }}" == "i386" ]; then |
| 64 | + ENTRYPOINT=linux32 |
| 65 | + else |
| 66 | + ENTRYPOINT= |
| 67 | + fi |
| 68 | + docker run -e CXXFLAGS -v $(pwd):/gha ${{ matrix.platform }}/alpine:3.15 ${ENTRYPOINT} sh -ec "cd /gha && sh ./build.sh" |
| 69 | + - name: Check binaries |
| 70 | + run: | |
| 71 | + cat <<EOF > check.sh |
| 72 | + set -e |
| 73 | + set -x |
| 74 | + tar -xf ./dist/patchelf-*-*.tar.gz |
| 75 | + ./bin/patchelf --version |
| 76 | + EOF |
| 77 | + docker run -v $(pwd):/gha ${{ matrix.platform }}/debian:stable-slim sh -ec "cd /gha && sh ./check.sh" |
| 78 | + - uses: actions/upload-artifact@v2 |
| 79 | + with: |
| 80 | + name: patchelf |
| 81 | + path: dist/* |
| 82 | + |
| 83 | + publish: |
| 84 | + name: Publish tarballs & binaries |
| 85 | + needs: [build_tarballs, build_binaries] |
| 86 | + if: github.event_name == 'push' && github.repository == 'NixOS/patchelf' && startsWith(github.ref, 'refs/tags/') |
| 87 | + runs-on: ubuntu-latest |
| 88 | + steps: |
| 89 | + - uses: actions/download-artifact@v2 |
| 90 | + with: |
| 91 | + name: patchelf |
| 92 | + path: dist |
20 | 93 | - name: Upload binaries to release |
21 | 94 | uses: svenstaro/upload-release-action@v2 |
22 | 95 | with: |
|
0 commit comments