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

Identify logic change (#27) #15

Identify logic change (#27)

Identify logic change (#27) #15

Workflow file for this run

name: Releaser
on:
push:
branches-ignore:
- '**'
tags:
- 'v*.*.*'
- 'v*.*.*-*'
jobs:
binary_linux_amd64:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: install cargo deps and build avail
shell: bash
run: |
curl https://sh.rustup.rs -sSf | sh -s -- -y
source "$HOME/.cargo/env"
sudo apt-get update && sudo apt-get install -y protobuf-compiler
cargo build -p avail-light-bootstrap --release
mv target/release/avail-light-bootstrap target/release/avail-light-bootstrap-linux-amd64
pushd target/release/
tar czf avail-light-bootstrap-linux-amd64.tar.gz avail-light-bootstrap-linux-amd64
popd
- uses: actions/upload-artifact@v2
with:
name: avail-light-bootstrap-linux-amd64-binary
path: target/release/avail-light-bootstrap-linux-amd64.tar.gz
binary_linux_arm64:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: install cargo deps and build avail
shell: bash
run: |
curl https://sh.rustup.rs -sSf | sh -s -- -y
source "$HOME/.cargo/env"
rustup target add aarch64-unknown-linux-gnu
sudo apt-get update && sudo apt-get install -y musl-tools clang gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libc6-dev libc6-dev-arm64-cross libssl-dev pkg-config librust-openssl-dev build-essential protobuf-compiler
env BINDGEN_EXTRA_CLANG_ARGS='--sysroot /usr/aarch64-linux-gnu' CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=/usr/bin/aarch64-linux-gnu-gcc cargo build --profile release --target=aarch64-unknown-linux-gnu -p avail-light-bootstrap
mv target/aarch64-unknown-linux-gnu/release/avail-light-bootstrap target/aarch64-unknown-linux-gnu/release/avail-light-bootstrap-linux-aarch64
pushd target/aarch64-unknown-linux-gnu/release/
tar czf avail-light-bootstrap-linux-arm64.tar.gz avail-light-bootstrap-linux-aarch64
popd
- uses: actions/upload-artifact@v2
with:
name: avail-light-bootstrap-linux-arm64-binary
path: target/aarch64-unknown-linux-gnu/release/avail-light-bootstrap-linux-arm64.tar.gz
binary_apple_arm64:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: install cargo deps and build avail
shell: bash
run: |
curl https://sh.rustup.rs -sSf | sh -s -- -y
source "$HOME/.cargo/env"
rustup target add aarch64-apple-darwin
cargo build --profile release -p avail-light-bootstrap
mv target/release/avail-light-bootstrap target/release/avail-light-bootstrap-apple-arm64
pushd target/release/
tar czf avail-light-bootstrap-apple-arm64.tar.gz avail-light-bootstrap-apple-arm64
popd
- uses: actions/upload-artifact@v2
with:
name: avail-light-bootstrap-apple-arm64-binary
path: target/release/avail-light-bootstrap-apple-arm64.tar.gz
# can extend binary publish 'needs' to include more releases i.e. arm64 in future
binary_publish:
needs: [binary_linux_amd64, binary_linux_arm64, binary_apple_arm64]
runs-on: ubuntu-22.04
steps:
- uses: actions/download-artifact@v2
with:
name: avail-light-bootstrap-linux-amd64-binary
- uses: actions/download-artifact@v2
with:
name: avail-light-bootstrap-linux-arm64-binary
- uses: actions/download-artifact@v2
with:
name: avail-light-bootstrap-apple-arm64-binary
- name: Prepare
id: prepare
run: |
TAG=${GITHUB_REF#refs/tags/}
echo ::set-output name=tag_name::${TAG}
- name: publish binaries
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.PAT_TOKEN }}
file: /home/runner/work/avail-light-bootstrap/avail-light-bootstrap/avail-light-bootstrap*
release_name: ${{ steps.prepare.outputs.tag_name }}
tag: ${{ steps.prepare.outputs.tag_name }}
overwrite: true
file_glob: true
# build image and publish to dockerhub
docker_build_push:
needs: [binary_publish]
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Prepare
id: prepare
run: |
TAG=${GITHUB_REF#refs/tags/}
echo ::set-output name=tag_name::${TAG}
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push images
uses: docker/build-push-action@v3
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./Dockerfile.release
platforms: linux/amd64, linux/arm64
push: true
tags: availj/avail-light-bootstrap:${{ steps.prepare.outputs.tag_name }}
build-args: |
IMAGE_TAG=${{ steps.prepare.outputs.tag_name }}