This repository has been archived by the owner on Aug 8, 2024. It is now read-only.
openssl env #11
Workflow file for this run
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
name: Build and Dockerize | |
on: | |
push: | |
tags: | |
- '*' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
OPENSSL_DIR: /usr/include/openssl | |
steps: | |
- name: Extract tag name | |
id: extract_tag | |
run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install dependencies | |
run: | | |
sudo apt update | |
sudo apt install -y clang gcc-aarch64-linux-gnu protobuf-compiler libssl-dev | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
components: rustfmt, clippy | |
- name: Add Rust targets | |
run: | | |
rustup target add x86_64-unknown-linux-gnu | |
rustup target add x86_64-apple-darwin | |
rustup target add aarch64-unknown-linux-gnu | |
rustup target add aarch64-apple-darwin | |
- name: Build binaries | |
run: | | |
cargo build --release --target x86_64-unknown-linux-gnu | |
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc cargo build --release --target aarch64-unknown-linux-gnu | |
cargo install cross | |
cross build --release --target x86_64-apple-darwin | |
cross build --release --target aarch64-apple-darwin | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
push: true | |
tags: ghcr.io/ark-network/clark:latest,ghcr.io/ark-network/clark:${{ env.TAG }} | |
platforms: linux/amd64,linux/arm64 | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.TAG }} | |
release_name: Release ${{ env.TAG }} | |
draft: false | |
prerelease: false | |
- name: Upload Release Assets | |
run: | | |
for binary in arkd noah; do | |
for target in x86_64-unknown-linux-gnu x86_64-apple-darwin aarch64-unknown-linux-gnu aarch64-apple-darwin; do | |
path="./target/$target/release/$binary" | |
echo "Uploading $path" | |
curl \ | |
--header "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
--header "Content-Type: $(file -b --mime-type $path)" \ | |
--data-binary @$path \ | |
--request POST \ | |
"${{ steps.create_release.outputs.upload_url }}?name=$binary-$target" | |
done | |
done | |
- name: Update Release Description | |
uses: actions/github-script@v5 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
script: | | |
const { owner, repo } = context.repo | |
const releaseId = ${{ steps.create_release.outputs.id }} | |
const dockerImage = `ghcr.io/ark-network/clark` | |
const newBody = `Docker image available at \`${dockerImage}\`. You can pull it using \`docker pull ${dockerImage}\`.` | |
github.rest.repos.updateRelease({ | |
owner, | |
repo, | |
release_id: releaseId, | |
body: newBody | |
}) |