-
Notifications
You must be signed in to change notification settings - Fork 214
121 lines (106 loc) · 3.46 KB
/
dockerhub.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# Generate latest build and push it to dockerhub on push to develop branch.
# NOTE: This workflow does not include any tests, nor any dependencies, since bors guarantees
# that only code that passes all tests is ever pushed to develop.
name: Push to Dockerhub
run-name: Pushing ${{ github.ref_name }} to Dockerhub
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
on:
push:
branches:
- develop
tags:
- '*'
workflow_dispatch:
inputs:
custom_image_tag:
description: 'A custom image tag'
default: ''
jobs:
dockerpush-images:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-22.04
outname_sufix: "linux-amd64"
- os: ubuntu-latest-arm-8-cores
outname_sufix: "linux-arm64"
steps:
- name: checkout
uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.GH_ACTION_PRIVATE_KEY }}
- uses: extractions/netrc@v2
with:
machine: github.com
username: ${{ secrets.GH_ACTION_TOKEN_USER }}
password: ${{ secrets.GH_ACTION_TOKEN }}
if: vars.GOPRIVATE
- name: get tag sufix arm64
if: ${{ runner.arch == 'arm64' }}
run: |
echo "SUFIX=-arm64" >> $GITHUB_ENV
- name: get tag sufix amd64
if: ${{ runner.arch != 'arm64' }}
run: |
echo "SUFIX=-amd64" >> $GITHUB_ENV
- name: Build docker images
run: |
export VERSION="${{ github.ref_name }}" TAG_SUFIX=$SUFIX
make dockerbuild-go
make dockerbuild-bs
- name: Push docker images to dockerhub
run: |
export TAG_SUFIX=$SUFIX
make dockerpush-only
make dockerpush-bs-only
- name: Push docker images to dockerhub
if: inputs.custom_image_tag
run: |
export DOCKER_IMAGE_VERSION="${{ inputs.custom_image_tag }}" TAG_SUFIX=$SUFIX
make dockerpush-only
make dockerpush-bs-only
- name: Push docker images with version tag to dockerhub
if: startsWith(github.ref, 'refs/tags/')
run: |
export DOCKER_IMAGE_VERSION="${{ github.ref_name }}" TAG_SUFIX=$SUFIX
make dockerpush-only
make dockerpush-bs-only
export DOCKER_IMAGE_REPO="go-spacemesh"
make dockerpush-only
make dockerpush-bs-only
dockerpush-manifest:
needs: [dockerpush-images]
runs-on: ubuntu-22.04
steps:
- name: checkout
uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.GH_ACTION_PRIVATE_KEY }}
- uses: extractions/netrc@v2
with:
machine: github.com
username: ${{ secrets.GH_ACTION_TOKEN_USER }}
password: ${{ secrets.GH_ACTION_TOKEN }}
if: vars.GOPRIVATE
- name: Push docker manifest to dockerhub
run: |
make dockerpush-go-manifest
make dockerpush-bs-manifest
- name: Push docker manifest to dockerhub
if: inputs.custom_image_tag
run: |
export DOCKER_IMAGE_VERSION="${{ inputs.custom_image_tag }}"
make dockerpush-go-manifest
make dockerpush-bs-manifest
- name: Push docker manifest with version tag to dockerhub
if: startsWith(github.ref, 'refs/tags/')
run: |
export DOCKER_IMAGE_VERSION="${{ github.ref_name }}"
make dockerpush-go-manifest
make dockerpush-bs-manifest
export DOCKER_IMAGE_REPO="go-spacemesh"
make dockerpush-go-manifest
make dockerpush-bs-manifest