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

Commit

Permalink
CI: build release and publish binary to github release page and docke…
Browse files Browse the repository at this point in the history
…r image (#225)
  • Loading branch information
fewensa authored Aug 4, 2021
1 parent 1e723a6 commit 71c32b2
Show file tree
Hide file tree
Showing 7 changed files with 176 additions and 5 deletions.
34 changes: 29 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,36 @@
name: Release

on:
push:
tags: ["*"]
branches: ["feature/docker-image"]
tags:
- 'v*'

jobs:
build-docker-image:
build-publish-github-release:
name: Build binary
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Build bridger
env:
RUST_TOOLCHAIN: nightly-2021-04-15
run: |
.maintain/setup-bridger.sh
- name: Publish github release
uses: docker://antonyurchenko/git-release:latest
if: startsWith(github.ref, 'refs/tags/v')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DRAFT_RELEASE: "false"
PRE_RELEASE: "false"
CHANGELOG_FILE: "CHANGELOG.md"
ALLOW_EMPTY_CHANGELOG: "false"
with:
args: |
deploy/bin/*
build-publish-docker-image:
name: Build Docker image
runs-on: ubuntu-latest
steps:
Expand All @@ -28,5 +52,5 @@ jobs:
- uses: ./.github/actions/docker-build-deploy
with:
docker_registry: quay.io
docker_build_options: -f .maintain/Dockerfile
docker_build_options: -f .maintain/docker/Dockerfile.publish-docker-image
skip_deploy: true
29 changes: 29 additions & 0 deletions .maintain/docker/Dockerfile.aarch64-linux-gnu
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This file is part of Darwinia.
#
# Copyright (C) 2018-2021 Darwinia Network
# SPDX-License-Identifier: GPL-3.0
#
# Darwinia is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Darwinia is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Darwinia. If not, see <https://www.gnu.org/licenses/>.

FROM rustembedded/cross:aarch64-unknown-linux-gnu

# only for aarch64

# change mirrorlist
RUN apt update && apt install -y \
# lib
libc6-dev-i386 \
# compiler
gcc-aarch64-linux-gnu gcc-5-aarch64-linux-gnu g++-aarch64-linux-gnu g++-5-aarch64-linux-gnu \
clang llvm libclang-dev
File renamed without changes.
28 changes: 28 additions & 0 deletions .maintain/docker/Dockerfile.x86_64-linux-gnu
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This file is part of Darwinia.
#
# Copyright (C) 2018-2021 Darwinia Network
# SPDX-License-Identifier: GPL-3.0
#
# Darwinia is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Darwinia is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Darwinia. If not, see <https://www.gnu.org/licenses/>.

FROM ubuntu:16.04

# for gernal linux

# change mirrorlist
RUN apt update && apt install -y \
# tool
git make \
# compiler
gcc g++ clang-4.0
47 changes: 47 additions & 0 deletions .maintain/setup-bridger.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash
#

set -xe

BIN_PATH=$(dirname $(readlink -f $0))
WORK_PATH=${BIN_PATH}/../

echo -e '\e[1;32m📥 Installing Cross Compile Toolchain(s)\e[0m'
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
sh -s -- -y --profile minimal --default-toolchain ${RUST_TOOLCHAIN}
source ~/.cargo/env

echo -e '\e[1;32m🔧 Building Docker Image(s)\e[0m'
docker build -f .maintain/docker/Dockerfile.x86_64-linux-gnu -t x86_64-linux-gnu .

cargo install cross --git https://github.com/l2ust/cross

rustup target add \
x86_64-unknown-linux-gnu \
aarch64-unknown-linux-gnu \
wasm32-unknown-unknown

mkdir -p ${WORK_PATH}/deploy/bin

cross build \
--release \
--target x86_64-unknown-linux-gnu


cd ${WORK_PATH}/deploy/bin/

cp ${WORK_PATH}/target/x86_64-unknown-linux-gnu/release/bridger ${WORK_PATH}/deploy/bin/
chmod +x bridger
tar cjSf bridger-x86_64-linux-gnu.tar.bz2 bridger
mv ${WORK_PATH}/deploy/bin/bridger ${WORK_PATH}/deploy/


echo -e '\e[1;32m🔑 Generating File(s) Hash\e[0m'

md5sum * > ../md5sums.txt
sha256sum * > ../sha256sums.txt

mv ../md5sums.txt .
mv ../sha256sums.txt .

ls
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## [0.4.0] - 2021-08-04

### Tasks

| type | bridge | doc |
| ------------------- | ----------------- | ---------------------------------------------------- |
| substrate-ethereum | darwinia-ethereum | [Guide](https://github.com/darwinia-network/bridger/task/task-darwinia-ethereum/docs/Guide.md) |
| substrate-substrate | pangolin-millau | [Guide](https://github.com/darwinia-network/bridger/task/task-pangolin-millau/docs/Guide.md) |

### Migrate

Migrate darwinia-ethereum 0.3.x to 0.4.x

https://github.com/darwinia-network/bridger/blob/master/task/task-darwinia-ethereum/docs/Guide.md#migrate-03x-to-04x

28 changes: 28 additions & 0 deletions Cross.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This file is part of Darwinia.
#
# Copyright (C) 2018-2021 Darwinia Network
# SPDX-License-Identifier: GPL-3.0
#
# Darwinia is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Darwinia is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Darwinia. If not, see <https://www.gnu.org/licenses/>.

[target.x86_64-unknown-linux-gnu]
image = "x86_64-linux-gnu"

[target.aarch64-unknown-linux-gnu]
image = "aarch64-linux-gnu"
[target.aarch64-unknown-linux-gnu.env]
passthrough = [
"RUSTFLAGS",
"SKIP_WASM_BUILD",
]

0 comments on commit 71c32b2

Please sign in to comment.