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

Add staging workflow #258

Merged
merged 10 commits into from
Feb 7, 2023
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really? It looks like we build this for every commit.

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" ]