122 lines
4.9 KiB
YAML
122 lines
4.9 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
|
|
jobs:
|
|
release-linux-binaries:
|
|
permissions:
|
|
contents: 'read'
|
|
id-token: 'write'
|
|
runs-on: ubuntu-20.04
|
|
strategy:
|
|
matrix:
|
|
target: [x86_64-unknown-linux-musl, aarch64-unknown-linux-musl]
|
|
include:
|
|
- target: x86_64-unknown-linux-musl
|
|
docker_image: registry.gitlab.com/rust_musl_docker/image:stable-latest
|
|
docker_options: -v /home/runner/work/heartwood/heartwood:/workdir -v /home/runner/.cargo/git:/root/.cargo/git -v /home/runner/.cargo/registry:/root/.cargo/registry
|
|
- target: aarch64-unknown-linux-musl
|
|
docker_image: messense/rust-musl-cross:aarch64-musl
|
|
docker_options: -v /home/runner/work/heartwood/heartwood:/home/rust/src -v /home/runner/.cargo/git:/root/.cargo/git -v /home/runner/.cargo/registry:/root/.cargo/registry
|
|
steps:
|
|
- name: Checkout source code
|
|
uses: actions/checkout@v3
|
|
- name: Configure build cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
|
|
- name: Build the binaries
|
|
uses: addnab/docker-run-action@v3
|
|
with:
|
|
image: ${{ matrix.docker_image }}
|
|
options: ${{ matrix.docker_options }}
|
|
run: |
|
|
rustup target add ${{ matrix.target }}
|
|
cargo build --target=${{ matrix.target }} --package=radicle-httpd --release
|
|
cargo build --target=${{ matrix.target }} --package=radicle-node --release
|
|
cargo build --target=${{ matrix.target }} --bin rad --release
|
|
cargo build --target=${{ matrix.target }} --bin git-remote-rad --release
|
|
chmod --recursive go+r /root/.cargo/registry
|
|
- shell: bash
|
|
run: |
|
|
staging="${{ matrix.target }}"
|
|
mkdir -p "$staging"
|
|
cp target/${{ matrix.target }}/release/radicle-httpd "$staging"/
|
|
cp target/${{ matrix.target }}/release/radicle-node "$staging"/
|
|
cp target/${{ matrix.target }}/release/rad "$staging"/
|
|
cp target/${{ matrix.target }}/release/git-remote-rad "$staging"/
|
|
tar czf "$staging.tar.gz" "$staging"
|
|
cp "$staging.tar.gz" "$staging"/
|
|
- id: 'auth'
|
|
uses: 'google-github-actions/auth@v1'
|
|
with:
|
|
workload_identity_provider: 'projects/281042598092/locations/global/workloadIdentityPools/github-actions/providers/google-cloud'
|
|
service_account: 'github-actions@radicle-services.iam.gserviceaccount.com'
|
|
- name: 'Set up Cloud SDK'
|
|
uses: 'google-github-actions/setup-gcloud@v1'
|
|
- id: 'upload-file'
|
|
uses: 'google-github-actions/upload-cloud-storage@v1'
|
|
with:
|
|
path: ${{ matrix.target }}
|
|
destination: heartwood-artifacts/${{ github.sha }}/
|
|
|
|
|
|
release-macos-binaries:
|
|
permissions:
|
|
contents: 'read'
|
|
id-token: 'write'
|
|
runs-on: macos-11
|
|
strategy:
|
|
matrix:
|
|
target:
|
|
- aarch64-apple-darwin
|
|
- x86_64-apple-darwin
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Configure build cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
target: ${{ matrix.target }}
|
|
- name: Build the release binaries
|
|
run: |
|
|
cargo build --target ${{ matrix.target }} --package=radicle-httpd --release
|
|
cargo build --target ${{ matrix.target }} --package=radicle-node --release
|
|
cargo build --target ${{ matrix.target }} --bin rad --release
|
|
cargo build --target ${{ matrix.target }} --bin git-remote-rad --release
|
|
- shell: bash
|
|
run: |
|
|
staging="${{ matrix.target }}"
|
|
mkdir -p "$staging"
|
|
cp target/${{ matrix.target }}/release/radicle-httpd "$staging"/
|
|
cp target/${{ matrix.target }}/release/radicle-node "$staging"/
|
|
cp target/${{ matrix.target }}/release/rad "$staging"/
|
|
cp target/${{ matrix.target }}/release/git-remote-rad "$staging"/
|
|
tar czf "$staging.tar.gz" "$staging"
|
|
cp "$staging.tar.gz" "$staging"/
|
|
- id: 'auth'
|
|
uses: 'google-github-actions/auth@v1'
|
|
with:
|
|
workload_identity_provider: 'projects/281042598092/locations/global/workloadIdentityPools/github-actions/providers/google-cloud'
|
|
service_account: 'github-actions@radicle-services.iam.gserviceaccount.com'
|
|
- name: 'Set up Cloud SDK'
|
|
uses: 'google-github-actions/setup-gcloud@v1'
|
|
- id: 'upload-file'
|
|
uses: 'google-github-actions/upload-cloud-storage@v1'
|
|
with:
|
|
path: ${{ matrix.target }}
|
|
destination: heartwood-artifacts/${{ github.sha }}
|