|
| 1 | +name: "Build rendezvous server release binaries" |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [created] |
| 6 | + |
| 7 | +jobs: |
| 8 | + build_binaries: |
| 9 | + name: Build rendezvous-server binary |
| 10 | + strategy: |
| 11 | + matrix: |
| 12 | + include: |
| 13 | + - bin: rendezvous_server |
| 14 | + target: x86_64-unknown-linux-gnu |
| 15 | + os: ubuntu-latest |
| 16 | + archive_ext: tar |
| 17 | + runs-on: ${{ matrix.os }} |
| 18 | + steps: |
| 19 | + - name: Checkout tagged commit |
| 20 | + |
| 21 | + with: |
| 22 | + ref: ${{ github.event.release.target_commitish }} |
| 23 | + token: ${{ secrets.BOTTY_GITHUB_TOKEN }} |
| 24 | + |
| 25 | + - uses: Swatinem/[email protected] |
| 26 | + |
| 27 | + - name: Build ${{ matrix.target }} ${{ matrix.bin }} release binary |
| 28 | + |
| 29 | + run: cargo build --target=${{ matrix.target }} --release --package rendezvous-server --bin ${{ matrix.bin }} |
| 30 | + |
| 31 | + - name: Smoke test the binary |
| 32 | + run: target/${{ matrix.target }}/release/${{ matrix.bin }} --help |
| 33 | + |
| 34 | + # Remove once python 3 is the default |
| 35 | + |
| 36 | + with: |
| 37 | + python-version: '3.x' |
| 38 | + |
| 39 | + - id: create-archive-name |
| 40 | + shell: python # Use python to have a prettier name for the archive on Windows. |
| 41 | + run: | |
| 42 | + import platform |
| 43 | + os_info = platform.uname() |
| 44 | +
|
| 45 | + arch = os_info.machine |
| 46 | +
|
| 47 | + triple = "${{ matrix.target }}".split("-") |
| 48 | + arch = triple[0] |
| 49 | +
|
| 50 | + archive_name=f'${{ matrix.bin }}_${{ github.event.release.tag_name }}_{os_info.system}_{arch}.${{ matrix.archive_ext }}' |
| 51 | +
|
| 52 | + print(f'::set-output name=archive::{archive_name}') |
| 53 | +
|
| 54 | + - name: Pack linux archive |
| 55 | + if: matrix.os == 'ubuntu-latest' |
| 56 | + shell: bash |
| 57 | + run: tar -C ./target/${{ matrix.target }}/release --create --file=${{ steps.create-archive-name.outputs.archive }} ${{ matrix.bin }} |
| 58 | + |
| 59 | + - name: Upload archive |
| 60 | + |
| 61 | + env: |
| 62 | + GITHUB_TOKEN: ${{ secrets.BOTTY_GITHUB_TOKEN }} |
| 63 | + with: |
| 64 | + upload_url: ${{ github.event.release.upload_url }} |
| 65 | + asset_path: ./${{ steps.create-archive-name.outputs.archive }} |
| 66 | + asset_name: ${{ steps.create-archive-name.outputs.archive }} |
| 67 | + asset_content_type: application/gzip |
0 commit comments