Keep authoring version 1 to allow non-updated #28
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 Release Artifacts | |
on: | |
push: | |
tags: | |
- "*" | |
permissions: read-all | |
jobs: | |
build-native-runtime: | |
strategy: | |
fail-fast: false | |
matrix: | |
operating-system: [ubuntu-22.04, windows-2022, macos-11] | |
runs-on: ${{ matrix.operating-system }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set-up Linux | |
if: matrix.operating-system == 'ubuntu-22.04' | |
run: | | |
sudo apt-get update | |
sudo apt install -y cmake pkg-config libssl-dev git build-essential clang libclang-dev curl | |
- name: Install protobuf | |
uses: arduino/setup-protoc@v2 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Configure rustc version | |
shell: bash | |
run: | | |
source ci/env | |
echo "RUSTC_VERSION=$RUSTC_VERSION" >> "$GITHUB_ENV" | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ env.RUSTC_VERSION }} | |
target: wasm32-unknown-unknown | |
profile: minimal | |
override: true | |
- name: Install MacOS aarch64 target | |
if: matrix.operating-system == 'macos-11' | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ env.RUSTC_VERSION }} | |
target: aarch64-apple-darwin | |
profile: minimal | |
override: true | |
- uses: Swatinem/rust-cache@v2 | |
- name: Figure out platform | |
shell: bash | |
run: | | |
PLATFORM=$(rustup target list --installed | grep "$(uname -m)") | |
echo "PLATFORM=$PLATFORM" >> "$GITHUB_ENV" | |
- name: Figure out tag name | |
shell: bash | |
run: | | |
TAG_NAME=$(git describe --tag) | |
echo "TAG_NAME=$TAG_NAME" >> "$GITHUB_ENV" | |
- name: DEBUG | |
shell: bash | |
run: | | |
echo "Tag & Platform is '${{ env.TAG_NAME }}-${{ env.PLATFORM }}'" | |
- name: Build | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --release | |
- name: Build MacOS aarch64 target | |
if: matrix.operating-system == 'macos-11' | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --release --target aarch64-apple-darwin | |
- name: Compress | |
uses: thedoctor0/zip-release@0.7.1 | |
with: | |
type: "zip" | |
directory: "target/release/" | |
path: "creditcoin-node*" | |
filename: "../../creditcoin-${{ env.TAG_NAME }}-${{ env.PLATFORM }}.zip" | |
exclusions: "creditcoin-node.d" | |
- name: Compress MacOS aarch64 target | |
if: matrix.operating-system == 'macos-11' | |
uses: thedoctor0/zip-release@0.7.1 | |
with: | |
type: "zip" | |
directory: "target/aarch64-apple-darwin/release/" | |
path: "creditcoin-node*" | |
filename: "../../../creditcoin-${{ env.TAG_NAME }}-aarch64-apple-darwin.zip" | |
exclusions: "creditcoin-node.d" | |
- name: Upload binary | |
uses: actions/upload-artifact@v3 | |
with: | |
path: "creditcoin-${{ env.TAG_NAME }}-*.zip" | |
if-no-files-found: error | |
build-wasm-runtime: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Figure out tag name | |
shell: bash | |
run: | | |
TAG_NAME=$(git describe --tag) | |
echo "TAG_NAME=$TAG_NAME" >> "$GITHUB_ENV" | |
- name: Build WASM runtime | |
id: srtool_build | |
uses: chevdor/srtool-actions@v0.6.0 | |
with: | |
chain: "creditcoin" | |
runtime_dir: runtime | |
package: creditcoin-node-runtime | |
tag: "1.66.1" # FIXME: remove this option (use the latest) once we're building w/ stable rust | |
workdir: ${{ github.workspace }} | |
- name: DEBUG | |
run: | | |
echo '${{ steps.srtool_build.outputs.json }}' | jq . > creditcoin-srtool-digest.json | |
cat creditcoin-srtool-digest.json | |
echo "Runtime location: ${{ steps.srtool_build.outputs.wasm }}" | |
- name: Rename file | |
run: | | |
mv ${{ steps.srtool_build.outputs.wasm }} creditcoin-${{ env.TAG_NAME }}-runtime.wasm | |
- name: Upload binary | |
uses: actions/upload-artifact@v3 | |
with: | |
path: "*.wasm" | |
if-no-files-found: error | |
docker-build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Figure out tag name | |
shell: bash | |
run: | | |
TAG_NAME=$(git describe --tag) | |
echo "TAG_NAME=$TAG_NAME" >> "$GITHUB_ENV" | |
- name: Build docker image | |
run: | | |
docker build -t gluwa/creditcoin:${{ env.TAG_NAME }} . | |
docker tag gluwa/creditcoin:${{ env.TAG_NAME }} gluwa/creditcoin:latest | |
echo "${{ secrets.DOCKER_PUSH_PASSWORD }}" | docker login -u="${{ secrets.DOCKER_PUSH_USERNAME }}" --password-stdin | |
docker push gluwa/creditcoin:${{ env.TAG_NAME }} | |
docker push gluwa/creditcoin:latest | |
docker logout | |
build-creditcoin-js: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- run: npm install -g yarn | |
- name: Figure out tag name | |
shell: bash | |
run: | | |
TAG_NAME=$(git describe --tag) | |
echo "TAG_NAME=$TAG_NAME" >> "$GITHUB_ENV" | |
- name: Build creditcoin-js package | |
run: | | |
pushd creditcoin-js/ | |
# version will match the git tag | |
echo "DEBUG: Tag is '${{ env.TAG_NAME }}" | |
sed -i 's/"version": ".*",/"version": "${{ env.TAG_NAME }}",/' package.json | |
yarn install && yarn pack | |
popd | |
- name: Upload binary | |
uses: actions/upload-artifact@v3 | |
with: | |
path: "creditcoin-js/creditcoin-js-v${{ env.TAG_NAME }}.tgz" | |
if-no-files-found: error | |
create-release: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
needs: | |
- build-native-runtime | |
- build-wasm-runtime | |
- build-creditcoin-js | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Figure out tag name | |
shell: bash | |
run: | | |
TAG_NAME=$(git describe --tag) | |
echo "TAG_NAME=$TAG_NAME" >> "$GITHUB_ENV" | |
- name: Download binaries | |
uses: actions/download-artifact@v3 | |
- name: DEBUG | |
shell: bash | |
run: | | |
ls -lR | |
- name: Make the release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: "artifact/creditcoin-*${{ env.TAG_NAME }}*" | |
fail_on_unmatched_files: true | |
name: ${{ env.TAG_NAME }} |