-
Notifications
You must be signed in to change notification settings - Fork 26
140 lines (115 loc) · 3.78 KB
/
docker.yaml
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: Docker
on:
push:
branches:
- main
- release/*
paths:
- "starship/docker/**"
- ".github/workflows/docker.yaml"
pull_request:
branches:
- main
paths:
- "starship/docker/**"
- ".github/workflows/docker.yaml"
types: [opened, reopened, synchronize, ready_for_review]
workflow_dispatch:
inputs:
type:
description: 'Type of docker image to build'
type: choice
required: true
options:
- "explorers"
- "faucet"
- "relayers"
- "starship"
- "chains"
process:
description: 'Process to run'
type: string
default: "all"
version:
description: 'Version of docker image to build'
type: string
default: "all"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-docker
cancel-in-progress: true
jobs:
build-push-types:
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
runs-on: ubuntu-latest
permissions:
packages: write
# subdirs of docker/ directory to build
strategy:
matrix:
build-type: [ "explorers", "faucet", "relayers", "starship" ]
max-parallel: 4
env:
DOCKER_REPO: ghcr.io/cosmology-tech/starship
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build
if: github.event_name == 'pull_request'
run: |
./starship/scripts/build-docker.sh --type ${{ matrix.build-type }} --process all --version all
- name: Build and push
if: github.event_name == 'push'
run: |
./starship/scripts/build-docker.sh --type ${{ matrix.build-type }} --process all --version all --push
- name: Force Build and Push for workflow dispatch
if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == matrix.build-type
run: |
./starship/scripts/build-docker.sh --type ${{ matrix.build-type }} --process all --version all --push --force
build-push-chains:
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
runs-on: ubuntu-latest
permissions:
packages: write
env:
DOCKER_REPO: ghcr.io/cosmology-tech/starship
defaults:
run:
working-directory: starship
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build chains
if: github.event_name == 'pull_request'
run: |
cd docker/chains && ./build-docker-chains.sh --chain all --tag all
- name: Build and push all chains
if: github.event_name == 'push'
run: |
cd docker/chains && ./build-docker-chains.sh --chain all --tag all --push
- name: Force Build and Push for workflow dispatch
if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'chains'
run: |
cd docker/chains && ./build-docker-chains.sh --chain $PROCESS --tag $VERSION --push --force
env:
PROCESS: ${{ github.event.inputs.process }}
VERSION: ${{ github.event.inputs.version }}