forked from moonbeam-foundation/moonbeam
-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (56 loc) · 2.41 KB
/
publish-docker.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
name: Publish Docker
on:
workflow_dispatch:
inputs:
tag:
description: tag (ex. v0.8.3) to publish on docker
required: true
jobs:
tag-docker:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Prepare
id: prep
run: |
DOCKER_IMAGE=moonbeamfoundation/moonbeam
VERSION="${{ github.event.inputs.tag }}"
COMMIT=`git rev-list -n 1 '${{ github.event.inputs.tag }}'`
COMMIT_SHA8=sha-${COMMIT::8}
mkdir -p build
wget https://github.com/moonbeam-foundation/moonbeam/releases/download/$VERSION/moonbeam -O build/moonbeam
wget https://github.com/moonbeam-foundation/moonbeam/releases/download/$VERSION/moonbeam-skylake -O build/moonbeam-skylake
wget https://github.com/moonbeam-foundation/moonbeam/releases/download/$VERSION/moonbeam-znver3 -O build/moonbeam-znver3
TAG_SHA="${DOCKER_IMAGE}:sha-${COMMIT_SHA8}"
TAG_VER="${DOCKER_IMAGE}:${VERSION}"
TAGS="${TAG_SHA},${TAG_VER}"
if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
MINOR=${VERSION%.*}
echo tagging "${DOCKER_IMAGE}:${MINOR}"
TAGS="${TAGS},${DOCKER_IMAGE}:${MINOR}"
MAJOR=${MINOR%.*}
echo tagging "${DOCKER_IMAGE}:${MAJOR}"
TAGS="${TAGS},${DOCKER_IMAGE}:${MAJOR}"
echo tagging "${DOCKER_IMAGE}:latest"
TAGS="${TAGS},${DOCKER_IMAGE}:latest"
fi
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
echo "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
- name: Cargo build
uses: ./.github/workflow-templates/publish-docker
with:
dockerhub_username: ${{ secrets.MBF_DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.MBF_DOCKERHUB_PASSWORD }}
image_tags: ${{ steps.prep.outputs.tags }}
image_title: ${{ github.event.repository.name }}
image_description: ${{ github.event.repository.description }}
image_url: ${{ github.event.repository.html_url }}
image_source: ${{ github.event.repository.clone_url }}
image_created: ${{ steps.prep.outputs.created }}
image_revision: ${{ github.sha }}
image_licenses: ${{ github.event.repository.license.spdx_id }}