|
12 | 12 | type: string |
13 | 13 |
|
14 | 14 | jobs: |
15 | | - compile: |
16 | | - name: Compile |
17 | | - runs-on: ${{ matrix.os }} |
18 | | - strategy: |
19 | | - matrix: |
20 | | - include: |
21 | | - - name: linux |
22 | | - os: ubuntu-22.04 # Use oldest supported non-deprecated version so we link against older glibc version which allows running binary on a wider set of Linux systems |
23 | | - path: target/x86_64-unknown-linux-gnu/release/function-runner |
24 | | - asset_name: function-runner-x86_64-linux-${{ inputs.tag_name || github.event.release.tag_name }} |
25 | | - shasum_cmd: sha256sum |
26 | | - target: x86_64-unknown-linux-gnu |
27 | | - - name: linux-arm64 |
28 | | - os: ubuntu-22.04 # Use oldest supported non-deprecated version so we link against older glibc version which allows running binary on a wider set of Linux systems |
29 | | - path: target/aarch64-unknown-linux-gnu/release/function-runner |
30 | | - asset_name: function-runner-arm-linux-${{ inputs.tag_name || github.event.release.tag_name }} |
31 | | - shasum_cmd: sha256sum |
32 | | - target: aarch64-unknown-linux-gnu |
33 | | - - name: macos |
34 | | - os: macos-latest |
35 | | - path: target/x86_64-apple-darwin/release/function-runner |
36 | | - asset_name: function-runner-x86_64-macos-${{ inputs.tag_name || github.event.release.tag_name }} |
37 | | - shasum_cmd: shasum -a 256 |
38 | | - target: x86_64-apple-darwin |
39 | | - - name: arm64-macos |
40 | | - os: macos-latest |
41 | | - path: target/aarch64-apple-darwin/release/function-runner |
42 | | - asset_name: function-runner-arm-macos-${{ inputs.tag_name || github.event.release.tag_name }} |
43 | | - shasum_cmd: shasum -a 256 |
44 | | - target: aarch64-apple-darwin |
45 | | - - name: windows |
46 | | - os: windows-latest |
47 | | - path: target\x86_64-pc-windows-msvc\release\function-runner.exe |
48 | | - asset_name: function-runner-x86_64-windows-${{ inputs.tag_name || github.event.release.tag_name }} |
49 | | - shasum_cmd: sha256sum |
50 | | - target: x86_64-pc-windows-msvc |
51 | | - |
| 15 | + build: |
| 16 | + uses: ./.github/workflows/build.yml |
| 17 | + with: |
| 18 | + tag_name: ${{ inputs.tag_name || github.event.release.tag_name }} |
| 19 | + should_upload_artifacts: true |
| 20 | + |
| 21 | + publish: |
| 22 | + name: Publish |
| 23 | + needs: build |
| 24 | + runs-on: ubuntu-latest |
52 | 25 | steps: |
53 | | - - uses: actions/checkout@v4 |
54 | | - |
55 | | - - name: Install cross compiler |
56 | | - if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }} |
57 | | - run: | |
58 | | - sudo apt-get update |
59 | | - sudo apt-get install -y gcc-aarch64-linux-gnu |
60 | | -
|
61 | | - - name: Set up cross compiler env variables |
62 | | - if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }} |
63 | | - run: | |
64 | | - echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV |
65 | | - echo "CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc" >> $GITHUB_ENV |
66 | | - echo "CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++" >> $GITHUB_ENV |
67 | | -
|
68 | | - # Should no-op except for macos-arm case where that target won't be installed |
69 | | - - name: Install target |
70 | | - run: rustup target add ${{ matrix.target }} |
71 | | - |
72 | | - - name: Build ${{ matrix.target }} |
73 | | - run: cargo build --release --target ${{ matrix.target }} --package function-runner |
74 | | - |
75 | | - - name: Archive assets |
76 | | - run: gzip -k -f ${{ matrix.path }} && mv ${{ matrix.path }}.gz ${{ matrix.asset_name }}.gz |
77 | | - |
78 | | - - name: Upload assets to artifacts |
79 | | - uses: actions/upload-artifact@v4 |
| 26 | + - name: Download all artifacts |
| 27 | + uses: actions/download-artifact@v4 |
80 | 28 | with: |
81 | | - name: ${{ matrix.asset_name }}.gz |
82 | | - path: ${{ matrix.asset_name }}.gz |
| 29 | + path: artifacts |
83 | 30 |
|
84 | 31 | - name: Upload assets to release |
85 | 32 | env: |
86 | 33 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
87 | | - run: gh release upload ${{ inputs.tag_name || github.event.release.tag_name }} ${{ matrix.asset_name }}.gz |
88 | | - |
89 | | - - name: Generate asset hash |
90 | | - run: ${{ matrix.shasum_cmd }} ${{ matrix.asset_name }}.gz | awk '{ print $1 }' > ${{ matrix.asset_name }}.gz.sha256 |
91 | | - |
92 | | - - name: Upload asset hash to artifacts |
93 | | - uses: actions/upload-artifact@v4 |
94 | | - with: |
95 | | - name: ${{ matrix.asset_name }}.gz.sha256 |
96 | | - path: ${{ matrix.asset_name }}.gz.sha256 |
97 | | - |
98 | | - - name: Upload asset hash to release |
99 | | - env: |
100 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
101 | | - run: gh release upload ${{ inputs.tag_name || github.event.release.tag_name }} ${{ matrix.asset_name }}.gz.sha256 |
| 34 | + run: | |
| 35 | + # Upload all files from the build job |
| 36 | + for file in artifacts/*; do |
| 37 | + gh release upload ${{ inputs.tag_name || github.event.release.tag_name }} $file |
| 38 | + done |
0 commit comments