Skip to content

Revamp all workflows #167

Revamp all workflows

Revamp all workflows #167

Workflow file for this run

name: Staging
on:
push:
branches: [main]
workflow_dispatch:
# TODO: just for test
pull_request:
branches:
- main
env:
CACHE_VERSION: 0
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
CARGO_TERM_COLOR: always
DOCKER_REGISTRY: ghcr.io
RUST_BACKTRACE: full
jobs:
build-package:
name: Build package [linux]
runs-on: ubuntu-latest
steps:
- name: Free disk space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: false
- name: Set swap space
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 8
- name: Fetch latest code
uses: actions/checkout@v3
- name: Build package
uses: ./.github/actions/build
with:
package: darwinia
features: all-natives
cache_prefix: staging-${{ env.CACHE_VERSION }}
enable_tar_bz2: true
- name: Upload
uses: actions/upload-artifact@v2
with:
name: darwinia-artifact
path: build
build-docker-image:
name: Build image
runs-on: ubuntu-latest
needs: [build-package]
steps:
- name: Fetch latest code
uses: actions/checkout@v3
- name: Sha
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: build
- name: Extract shared
run: |
mkdir -p dist
tar -xvf build/darwinia-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 }}