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

gh action and dockerfile #1

gh action and dockerfile

gh action and dockerfile #1

Workflow file for this run

name: Build and Dockerize
on:
push:
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy
- name: Build binaries
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
cargo build --release --target x86_64-unknown-linux-gnu
cargo build --release --target x86_64-apple-darwin
cargo build --release --target aarch64-unknown-linux-gnu
cargo 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: ark-network/clark:latest
platforms: linux/amd64,linux/arm64,darwin/amd64,darwin/arm64
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
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