-
Notifications
You must be signed in to change notification settings - Fork 572
140 lines (122 loc) · 5.23 KB
/
deploy-node-docker-image.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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Deploy Node Docker Image
on:
push:
branches:
'staging'
workflow_dispatch:
inputs:
github_tag_mainnet:
description: 'GitHub:mainnet'
type: boolean
default: false
github_tag_testnet:
description: 'GitHub:testnet'
type: boolean
default: false
aws_tag_mainnet:
description: 'AWS:mainnet'
type: boolean
default: false
aws_tag_testnet:
description: 'AWS:testnet'
type: boolean
default: false
aws_tag_git_sha:
description: 'AWS:{GIT_SHA}'
type: boolean
default: false
aws_tag_git_branch:
description: 'AWS:{BRANCH}'
type: boolean
default: false
permissions:
contents: read
packages: write
jobs:
Deploy:
name: Deploy
runs-on: ubuntu-22.04
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- name: Login to GitHub Registry
run: echo ${GITHUB_TOKEN} | docker login -u ${GITHUB_USER} --password-stdin ghcr.io
env:
GITHUB_USER: ${{ secrets.BREW_GITHUB_USERNAME }}
GITHUB_TOKEN: ${{ secrets.BREW_GITHUB_TOKEN }}
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Login to AWS Registry
run: aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin $AWS_REGISTRY_URL
env:
AWS_REGISTRY_URL: ${{ secrets.AWS_NODE_REGISTRY_URL }}
- name: Build Node Image
run: ./ironfish-cli/scripts/build-docker.sh
- name: Deploy Node Image to GitHub:mainnet
if: ${{ inputs.github_tag_mainnet }}
run: |
docker tag ironfish ghcr.io/iron-fish/ironfish:mainnet
docker push ghcr.io/iron-fish/ironfish:mainnet
# If we are deploying a new public release to mainnet
# also update the docker registry :latest tag for hygiene
- name: Deploy Node Image to GitHub:latest
if: ${{ inputs.github_tag_mainnet }}
run: |
docker tag ironfish ghcr.io/iron-fish/ironfish:latest
docker push ghcr.io/iron-fish/ironfish:latest
# Used if we are deploying a new version (e.g. v1.1)
- name: Deploy Node Image to GitHub:${{ github.ref_name }}
if: ${{ github.ref_type == 'tag'}}
run: |
docker tag ironfish ghcr.io/iron-fish/ironfish:${{ github.ref_name }}
docker push ghcr.io/iron-fish/ironfish:${{ github.ref_name }}
# Used to deploy images for specific branches
- name: Deploy Node Image to GitHub:${{ github.ref_name }}
if: ${{ github.ref_type == 'branch' }}
run: |
docker tag ironfish ghcr.io/iron-fish/ironfish:${{ github.ref_name }}
docker push ghcr.io/iron-fish/ironfish:${{ github.ref_name }}
- name: Deploy Node Image to GitHub:testnet
if: ${{ inputs.github_tag_testnet }}
run: |
docker tag ironfish ghcr.io/iron-fish/ironfish:testnet
docker push ghcr.io/iron-fish/ironfish:testnet
- name: Deploy Node Image to AWS:mainnet
if: ${{ inputs.aws_tag_mainnet }}
run: |
docker tag ironfish ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:mainnet
docker push ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:mainnet
# If we are deploying a new public release to mainnet
# also update the docker registry :latest tag for hygiene
- name: Deploy Node Image to AWS:latest
if: ${{ inputs.aws_tag_mainnet }}
run: |
docker tag ironfish ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:latest
docker push ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:latest
# Used if we are deploying a new version (e.g. v1.1)
# This is only executed when deploying a new release to mainnet
- name: Deploy Node Image to AWS:${{ github.ref_name }}
if: ${{ inputs.aws_tag_mainnet && github.event.ref_type == 'tag'}}
run: |
docker tag ironfish ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:${{ github.ref_name }}
docker push ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:${{ github.ref_name }}
# Used to deploy images for specific branches
- name: Deploy Node Image to AWS:${{ github.ref_name }}
if: ${{ inputs.aws_tag_git_branch && github.ref_type == 'branch' }}
run: |
docker tag ironfish ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:${{ github.ref_name }}
docker push ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:${{ github.ref_name }}
- name: Deploy Node Image to AWS:testnet
if: ${{ inputs.aws_tag_testnet }}
run: |
docker tag ironfish ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:testnet
docker push ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:testnet
- name: Deploy Node Image to AWS:${{ github.sha }}
if: ${{ inputs.aws_tag_git_sha }}
run: |
docker tag ironfish ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:${{ github.sha }}
docker push ${{ secrets.AWS_NODE_REGISTRY_URL }}/ironfish:${{ github.sha }}