forked from moonbeam-foundation/moonbeam
-
Notifications
You must be signed in to change notification settings - Fork 1
107 lines (103 loc) · 3.67 KB
/
prepare-binary.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Prepare Optimized Binary Draft (internal only)
# The code (like generate-release-body) will be taken from the tag version, not master
on:
workflow_dispatch:
inputs:
sha:
description: full sha to build the binary from
required: true
jobs:
####### Building binaries #######
build-binary:
runs-on: bare-metal
strategy:
matrix:
cpu: ["", "skylake"]
env:
RUSTFLAGS: "-C target-cpu=${{ matrix.cpu }}"
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.sha }}
- name: Setup Rust toolchain
run: rustup show
- name: Build Node
run: cargo build --profile=production --all
- name: Save parachain binary
if: ${{ matrix.cpu == '' }}
run: |
mkdir -p build
cp target/production/moonbeam build/moonbeam
- name: Save parachain custom binary
if: ${{ matrix.cpu != '' }}
run: |
mkdir -p build
cp target/production/moonbeam build/moonbeam-${{matrix.cpu}}
- name: Upload binary
uses: actions/[email protected]
with:
name: moonbeam
path: build
####### Prepare the release draft #######
docker-moonbeam:
runs-on: ubuntu-latest
needs: ["build-binary"]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.sha }}
- uses: actions/[email protected]
with:
name: moonbeam
path: build
- name: Prepare
id: prep
run: |
DOCKER_IMAGE=moonbeamfoundation/moonbeam
SHA8="$(git log -1 --format="%H" | cut -c1-8)"
TAGS="${DOCKER_IMAGE}:sha-${SHA8}-opt"
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
echo "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
version: latest
driver-opts: |
image=moby/buildkit:master
- name: Login to DockerHub
uses: docker/[email protected]
with:
username: ${{ secrets.MBF_DOCKERHUB_USERNAME }}
password: ${{ secrets.MBF_DOCKERHUB_TOKEN }}
- name: Build and push moonbeam
id: docker_build
uses: docker/build-push-action@v4
with:
context: .
file: ./docker/moonbeam.Dockerfile
platforms: linux/amd64
push: true
tags: ${{ steps.prep.outputs.tags }}
labels: |
org.opencontainers.image.title=${{ github.event.repository.name }}
org.opencontainers.image.description=${{ github.event.repository.description }}
org.opencontainers.image.url=${{ github.event.repository.html_url }}
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.licenses=${{ github.event.repository.license.spdx_id }}
- name: Login to DockerHub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Tag it with purestake for 6 month
run: |
PURESTAKE_TAG=`echo "${{ steps.prep.outputs.tags }}" | sed 's/moonbeamfoundation/purestake/'`
docker pull ${{ steps.prep.outputs.tags }}
docker tag ${{ steps.prep.outputs.tags }} $PURESTAKE_TAG
docker push $PURESTAKE_TAG