Skip to content
This repository was archived by the owner on Mar 30, 2023. It is now read-only.

Commit 60d19da

Browse files
fewensaaurexav
andauthored
Add staging workflow (#258)
* Add staging workflow * Test CI * CI * Add deps * CI * CI * CI * Updte trigger --------- Co-authored-by: Xavier Lau <[email protected]>
1 parent 7ecbe10 commit 60d19da

File tree

2 files changed

+98
-0
lines changed

2 files changed

+98
-0
lines changed

.github/workflows/staging.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Staging
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
workflow_dispatch:
7+
8+
env:
9+
DOCKER_REGISTRY: ghcr.io
10+
11+
jobs:
12+
build-package:
13+
name: Build package [linux]
14+
runs-on: ubuntu-latest
15+
container:
16+
image: ubuntu:18.04
17+
steps:
18+
- uses: actions/checkout@v3
19+
20+
- name: Install dependencies
21+
run: |
22+
apt update -y
23+
apt install --no-install-recommends -y \
24+
ca-certificates curl git python3-pip \
25+
clang make gcc g++ protobuf-compiler
26+
pip3 install --upgrade pip
27+
pip3 install cmake --upgrade
28+
29+
- name: Install Rust toolchain
30+
uses: actions-rs/toolchain@v1
31+
with:
32+
toolchain: nightly
33+
34+
- name: Build
35+
uses: actions-rs/cargo@v1
36+
with:
37+
command: build
38+
args: --release --locked
39+
40+
- name: Collect shared
41+
run: |
42+
mkdir -p shared
43+
tar cjSf \
44+
shared/darwinia2-x86_64-linux-gnu.tar.bz2 \
45+
-C \
46+
target/release \
47+
darwinia
48+
- name: Upload shared
49+
uses: actions/upload-artifact@v2
50+
with:
51+
name: darwinia-artifact
52+
path: shared
53+
54+
55+
build-docker-image:
56+
name: Build image
57+
runs-on: ubuntu-latest
58+
needs: [build-package]
59+
steps:
60+
- name: Fetch latest code
61+
uses: actions/checkout@v3
62+
63+
- uses: benjlevesque/[email protected]
64+
65+
- name: Docker login
66+
uses: docker/login-action@v1
67+
with:
68+
username: ${{ github.actor }}
69+
password: ${{ secrets.GITHUB_TOKEN }}
70+
registry: ${{ env.DOCKER_REGISTRY }}
71+
72+
- name: Download shared
73+
uses: actions/download-artifact@v2
74+
with:
75+
name: darwinia-artifact
76+
path: shared
77+
78+
- name: Extract shared
79+
run: |
80+
mkdir -p dist
81+
tar -xvf shared/darwinia2-x86_64-linux-gnu.tar.bz2 -C dist/
82+
83+
- name: Publish docker image
84+
uses: docker/build-push-action@v3
85+
with:
86+
push: true
87+
context: .
88+
file: .maintain/docker/Dockerfile
89+
tags: ${{ env.DOCKER_REGISTRY }}/${{ github.repository }}:sha-${{ env.SHA }}
90+
91+

.maintain/docker/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM debian:stable-slim
2+
3+
COPY dist/ /usr/local/bin
4+
5+
EXPOSE 9933 9944
6+
7+
ENTRYPOINT [ "/usr/local/bin/darwinia" ]

0 commit comments

Comments
 (0)