From 5acfeb2b7992b4b0f6b45269db6737e5bb8a8a02 Mon Sep 17 00:00:00 2001 From: Adam Szkoda Date: Thu, 19 Jan 2023 14:35:54 +0100 Subject: [PATCH] Release to Google Cloud Storage Signed-off-by: Adam Szkoda --- .github/workflows/release-cli.yml | 129 ---------------------------- .github/workflows/release-httpd.yml | 85 ------------------ .github/workflows/release.yml | 121 ++++++++++++++++++++++++++ 3 files changed, 121 insertions(+), 214 deletions(-) delete mode 100644 .github/workflows/release-cli.yml delete mode 100644 .github/workflows/release-httpd.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml deleted file mode 100644 index 635d8a13..00000000 --- a/.github/workflows/release-cli.yml +++ /dev/null @@ -1,129 +0,0 @@ -name: Release / cli -on: - push: - tags: - - "[0-9]+.[0-9]+.[0-9]+" - -jobs: - release-x86_64-linux-binaries: - runs-on: ubuntu-20.04 - steps: - - name: Checkout source code - uses: actions/checkout@v3 - - name: Configure build cache - uses: actions/cache@v3 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - !target/debian - key: cargo-x86_64-linux-${{ hashFiles('**/Cargo.lock') }} - - name: Build the binaries - uses: addnab/docker-run-action@v3 - with: - image: registry.gitlab.com/rust_musl_docker/image:stable-latest - options: -v ${{ github.workspace }}:/workdir -v /home/runner/.cargo/git:/root/.cargo/git -v /home/runner/.cargo/registry:/root/.cargo/registry - run: | - rustup target add x86_64-unknown-linux-musl - cargo build --release --target=x86_64-unknown-linux-musl --bin rad - cargo build --release --target=x86_64-unknown-linux-musl --bin git-remote-rad - chmod --recursive go+r /root/.cargo/registry - - name: Build deb package - uses: addnab/docker-run-action@v3 - with: - image: registry.gitlab.com/rust_musl_docker/image:stable-latest - options: -v ${{ github.workspace }}:/workdir -v /home/runner/.cargo/git:/root/.cargo/git -v /home/runner/.cargo/registry:/root/.cargo/registry - run: | - cargo install cargo-deb - cargo deb --target x86_64-unknown-linux-musl --no-build --package radicle-cli - chmod --recursive go+r /root/.cargo/registry - - shell: bash - run: | - staging="radicle-cli-x86_64-unknown-linux-musl" - mkdir -p "$staging" - cp target/x86_64-unknown-linux-musl/release/rad "$staging"/ - cp target/x86_64-unknown-linux-musl/release/git-remote-rad "$staging"/ - tar czf "$staging.tar.gz" "$staging" - - uses: softprops/action-gh-release@v1 - with: - fail_on_unmatched_files: true - files: | - radicle-cli-x86_64-unknown-linux-musl.tar.gz - target/x86_64-unknown-linux-musl/debian/*.deb - - - release-aarch64-linux-binaries: - runs-on: ubuntu-20.04 - steps: - - name: Checkout source code - uses: actions/checkout@v3 - - name: Configure build cache - uses: actions/cache@v3 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - !target/debian - key: cargo-aarch64-linux-${{ hashFiles('**/Cargo.lock') }} - - name: Build the binaries - uses: addnab/docker-run-action@v3 - with: - image: messense/rust-musl-cross:aarch64-musl - options: -v ${{ github.workspace }}:/home/rust/src -v /home/runner/.cargo/git:/root/.cargo/git -v /home/runner/.cargo/registry:/root/.cargo/registry - run: | - rustup target add aarch64-unknown-linux-musl - cargo build --release --bin rad - cargo build --release --bin git-remote-rad - - shell: bash - run: | - staging="radicle-cli-aarch64-unknown-linux-musl" - mkdir -p "$staging" - cp target/aarch64-unknown-linux-musl/release/rad "$staging"/ - cp target/aarch64-unknown-linux-musl/release/git-remote-rad "$staging"/ - tar czf "$staging.tar.gz" "$staging" - - uses: softprops/action-gh-release@v1 - with: - fail_on_unmatched_files: true - files: radicle-cli-aarch64-unknown-linux-musl.tar.gz - - release-macos-binaries: - runs-on: macos-11 - strategy: - matrix: - target: - - x86_64-apple-darwin - - aarch64-apple-darwin - steps: - - run: brew install asciidoctor - - uses: actions/checkout@v3 - - name: Configure build cache - uses: actions/cache@v3 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - !target/debian - 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 --release --target ${{ matrix.target }} --bin rad - cargo build --release --target ${{ matrix.target }} --bin git-remote-rad - - name: Build the release archive - shell: bash - run: | - staging="radicle-cli-${{ matrix.target }}" - mkdir -p "$staging" - cp target/${{ matrix.target }}/release/rad "$staging"/ - cp target/${{ matrix.target }}/release/git-remote-rad "$staging"/ - tar czf "$staging.tar.gz" "$staging" - - uses: softprops/action-gh-release@v1 - with: - fail_on_unmatched_files: true - files: radicle-cli-${{ matrix.target }}.tar.gz diff --git a/.github/workflows/release-httpd.yml b/.github/workflows/release-httpd.yml deleted file mode 100644 index d9f2e2eb..00000000 --- a/.github/workflows/release-httpd.yml +++ /dev/null @@ -1,85 +0,0 @@ -name: Release / httpd - -on: - push: - branches: [master] - -jobs: - release-gcloud-x86_64-linux-binaries: - permissions: - contents: 'read' - id-token: 'write' - runs-on: ubuntu-20.04 - 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-x86_64-linux-${{ hashFiles('**/Cargo.lock') }} - - name: Build the binaries - uses: addnab/docker-run-action@v3 - with: - image: registry.gitlab.com/rust_musl_docker/image:stable-latest - options: -v ${{ github.workspace }}:/workdir -v /home/runner/.cargo/git:/root/.cargo/git -v /home/runner/.cargo/registry:/root/.cargo/registry - run: | - rustup target add x86_64-unknown-linux-musl - cd radicle-httpd - cargo build --release --target=x86_64-unknown-linux-musl - chmod --recursive go+r /root/.cargo/registry - - 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: target/x86_64-unknown-linux-musl/release/radicle-httpd - destination: heartwood-artifacts/${{ github.sha }}/ - - release-gcloud-macos-binaries: - permissions: - contents: 'read' - id-token: 'write' - runs-on: macos-11 - strategy: - matrix: - target: - - aarch64-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: | - cd radicle-httpd - cargo build --release --target ${{ matrix.target }} - - 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: target/${{ matrix.target }}/release/radicle-httpd - destination: heartwood-artifacts/${{ github.sha }}/${{ matrix.target }}/ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..470fefb7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,121 @@ +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 }}