Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Commit

Permalink
ci: Add version file to binary release
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudhead committed Mar 13, 2024
1 parent 3ad2b44 commit 68aca1d
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 62 deletions.
88 changes: 45 additions & 43 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,20 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
target: [x86_64-unknown-linux-musl, aarch64-unknown-linux-musl]
# target: [x86_64-unknown-linux-musl, aarch64-unknown-linux-musl]
target: [x86_64-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
# - 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
uses: actions/checkout@v4
- name: Configure build cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
Expand All @@ -37,50 +38,51 @@ jobs:
image: ${{ matrix.docker_image }}
options: ${{ matrix.docker_options }}
run: .github/workflows/build.bash "${{ matrix.target }}"
- name: Build the debug binaries
uses: addnab/docker-run-action@v3
with:
image: ${{ matrix.docker_image }}
options: ${{ matrix.docker_options }}
run: .github/workflows/build-debug.bash "${{ matrix.target }}"
# - name: Build the debug binaries
# uses: addnab/docker-run-action@v3
# with:
# image: ${{ matrix.docker_image }}
# options: ${{ matrix.docker_options }}
# run: .github/workflows/build-debug.bash "${{ matrix.target }}"
- run: .github/workflows/upload.bash "${{ matrix.target }}" "${{ github.sha }}"
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}

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: dtolnay/rust-toolchain@1.67
- name: Build the release binaries
run: .github/workflows/build.bash "${{ matrix.target }}"
- name: Build the debug binaries
run: .github/workflows/build-debug.bash "${{ matrix.target }}"
- run: .github/workflows/upload.bash "${{ matrix.target }}" "${{ github.sha }}"
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
# 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@v4
# - name: Configure build cache
# uses: actions/cache@v4
# with:
# path: |
# ~/.cargo/registry
# ~/.cargo/git
# target
# key: cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
# - uses: dtolnay/rust-toolchain@stable
# - name: Build the release binaries
# run: .github/workflows/build.bash "${{ matrix.target }}"
# - name: Build the debug binaries
# run: .github/workflows/build-debug.bash "${{ matrix.target }}"
# - run: .github/workflows/upload.bash "${{ matrix.target }}" "${{ github.sha }}"
# env:
# SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}

update-latest-symlink:
needs: [release-linux-binaries, release-macos-binaries]
# needs: [release-linux-binaries, release-macos-binaries]
needs: [release-linux-binaries]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- run: .github/workflows/update-latest-symlink.bash "${{ github.sha }}"
- uses: actions/checkout@v4
- run: .github/workflows/update-latest-symlink.sh "${{ github.sha }}"
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
19 changes: 0 additions & 19 deletions .github/workflows/update-latest-symlink.bash

This file was deleted.

27 changes: 27 additions & 0 deletions .github/workflows/update-latest-symlink.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh

set -o errexit
set -o nounset

remotely() {
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i ssh-private-key [email protected] "$@"
}

main () {
if [ $# -ne 1 ]; then
echo "$#: Wrong number of arguments"
return 1
fi
target="x86_64-unknown-linux-musl"
sha=$1

trap 'rm -f ssh-private-key' EXIT

echo "$SSH_PRIVATE_KEY" > ssh-private-key
chmod go-rwx ssh-private-key

remotely "/mnt/radicle/releases/${sha}/${target}/rad version --json > /mnt/radicle/releases/${sha}/version.json"
# remotely ln -snf "/mnt/radicle/releases/${sha}" "/mnt/radicle/releases/latest"
}

main "$@"

0 comments on commit 68aca1d

Please sign in to comment.