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

Commit

Permalink
Add staging workflow (#258)
Browse files Browse the repository at this point in the history
* Add staging workflow

* Test CI

* CI

* Add deps

* CI

* CI

* CI

* Updte trigger

---------

Co-authored-by: Xavier Lau <[email protected]>
  • Loading branch information
fewensa and AurevoirXavier authored Feb 7, 2023
1 parent 7ecbe10 commit 60d19da
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 0 deletions.
91 changes: 91 additions & 0 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Staging

on:
push:
branches: [ main ]
workflow_dispatch:

env:
DOCKER_REGISTRY: ghcr.io

jobs:
build-package:
name: Build package [linux]
runs-on: ubuntu-latest
container:
image: ubuntu:18.04
steps:
- uses: actions/checkout@v3

- name: Install dependencies
run: |
apt update -y
apt install --no-install-recommends -y \
ca-certificates curl git python3-pip \
clang make gcc g++ protobuf-compiler
pip3 install --upgrade pip
pip3 install cmake --upgrade
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly

- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --locked

- name: Collect shared
run: |
mkdir -p shared
tar cjSf \
shared/darwinia2-x86_64-linux-gnu.tar.bz2 \
-C \
target/release \
darwinia
- name: Upload shared
uses: actions/upload-artifact@v2
with:
name: darwinia-artifact
path: shared


build-docker-image:
name: Build image
runs-on: ubuntu-latest
needs: [build-package]
steps:
- name: Fetch latest code
uses: actions/checkout@v3

- uses: benjlevesque/[email protected]

- name: Docker login
uses: docker/login-action@v1
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ${{ env.DOCKER_REGISTRY }}

- name: Download shared
uses: actions/download-artifact@v2
with:
name: darwinia-artifact
path: shared

- name: Extract shared
run: |
mkdir -p dist
tar -xvf shared/darwinia2-x86_64-linux-gnu.tar.bz2 -C dist/
- name: Publish docker image
uses: docker/build-push-action@v3
with:
push: true
context: .
file: .maintain/docker/Dockerfile
tags: ${{ env.DOCKER_REGISTRY }}/${{ github.repository }}:sha-${{ env.SHA }}


7 changes: 7 additions & 0 deletions .maintain/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM debian:stable-slim

COPY dist/ /usr/local/bin

EXPOSE 9933 9944

ENTRYPOINT [ "/usr/local/bin/darwinia" ]

0 comments on commit 60d19da

Please sign in to comment.