-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from hyphacoop/hermes-build
Hermes build
- Loading branch information
Showing
2 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
## Hermes Linux build: latest release | ||
|
||
Binaries are built to the latest release in the `informalsystems/hermes` repo. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
name: Hermes Linux Build | ||
|
||
on: | ||
workflow_dispatch: | ||
jobs: | ||
collect_remote_release: | ||
name: Read latest release from build repo | ||
runs-on: ubuntu-latest | ||
outputs: | ||
sha: ${{ steps.query_release.outputs.release }} | ||
steps: | ||
- name: Query latest release | ||
id: query_release | ||
run: | | ||
latest=$(curl -s -L -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/informalsystems/hermes/releases | jq -r '.[0].tag_name') | ||
echo "release=$latest" >> "$GITHUB_OUTPUT" | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
needs: [collect_remote_release] | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Check out repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: update apt | ||
run: | | ||
sudo apt update | ||
sudo apt dist-upgrade -y | ||
- name: Install tools | ||
run: | | ||
sudo apt-get install curl jq -y | ||
- name: Setup environment | ||
run: | | ||
sudo apt install build-essential wget pkg-config musl-tools -y | ||
- name: Install Rust | ||
run: | | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | ||
- name: Update PATH | ||
run: | | ||
echo "~/.cargo/bin" >> $GITHUB_PATH | ||
source "$HOME/.cargo/env" | ||
cargo version | ||
- name: Clone and build Hermes | ||
run: | | ||
source "$HOME/.cargo/env" | ||
LAST_RELEASE=${{needs.collect_remote_release.outputs.release}} | ||
git clone https://github.com/informalsystems/hermes.git | ||
cd hermes | ||
git checkout $LAST_RELEASE | ||
rustup target add x86_64-unknown-linux-musl | ||
#cargo build --release --bin hermes | ||
cargo build --target x86_64-unknown-linux-musl --release --bin hermes | ||
cp target/x86_64-unknown-linux-musl/release/hermes ~/hermes-linux | ||
- name: Print Hermes version | ||
run: | | ||
~/hermes-linux version | ||
# Publish | ||
- name: Remove old releases | ||
uses: dev-drprasad/[email protected] | ||
with: | ||
keep_latest: 0 | ||
delete_tag_pattern: "hermes-linux" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Add release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
artifacts: "~/hermes-linux" | ||
name: "Hermes ${{needs.collect_remote_release.outputs.release}}" | ||
bodyFile: .github/workflows/hermes-linux-body.md | ||
prerelease: true | ||
replacesArtifacts: false | ||
allowUpdates: false | ||
tag: "hermes-linux" | ||
token: ${{ secrets.GITHUB_TOKEN }} |