Skip to content

Commit 9a928a2

Browse files
authored
ci: release workflow (#76)
1 parent 51ec551 commit 9a928a2

File tree

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed

.github/workflows/release.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
on:
2+
release:
3+
types: [created]
4+
5+
name: Release
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
15+
- name: Use Node.js v10
16+
uses: actions/setup-node@v1
17+
with:
18+
node-version: 10.x
19+
20+
- name: yarn install, lint and test
21+
run: |
22+
yarn install --frozen-lockfile
23+
yarn lint
24+
buildECR:
25+
needs: test
26+
27+
name: Build image and push to Amazon ECR
28+
runs-on: ubuntu-latest
29+
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v2
33+
34+
- name: Build image
35+
run: |
36+
docker build -t kilt/mashnet-node .
37+
38+
- name: Configure AWS credentials
39+
uses: aws-actions/configure-aws-credentials@v1
40+
with:
41+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
42+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
43+
aws-region: eu-central-1
44+
45+
- name: Login to Amazon ECR
46+
id: login-ecr
47+
uses: aws-actions/amazon-ecr-login@v1
48+
49+
- name: Tag, and push image to Amazon ECR
50+
env:
51+
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
52+
ECR_REPOSITORY: kilt/prototype-chain
53+
run: |
54+
IMAGE_TAG=${GITHUB_REF#refs/tags/}
55+
docker tag kilt/mashnet-node $ECR_REGISTRY/$ECR_REPOSITORY:latest
56+
docker tag kilt/mashnet-node $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
57+
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
58+
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
59+
60+
buildDocker:
61+
needs: test
62+
63+
name: Build image and push to Docker Hub
64+
runs-on: ubuntu-latest
65+
66+
steps:
67+
- name: Checkout
68+
uses: actions/checkout@v2
69+
70+
- name: Build image
71+
run: |
72+
docker build -t kilt/mashnet-node .
73+
74+
- name: Login to Docker Hub
75+
env:
76+
DOCKER_USER: ${{ secrets.DOCKER_USER }}
77+
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
78+
run: |
79+
echo $DOCKER_PASS | docker login --username=$DOCKER_USER --password-stdin
80+
81+
- name: Tag, and push image to Docker Hub
82+
env:
83+
DOCKER_REPOSITORY: kiltprotocol/mashnet-node
84+
run: |
85+
IMAGE_TAG=${GITHUB_REF#refs/tags/}
86+
docker tag kilt/mashnet-node $DOCKER_REPOSITORY:latest
87+
docker tag kilt/mashnet-node $DOCKER_REPOSITORY:$IMAGE_TAG
88+
docker push $DOCKER_REPOSITORY:$IMAGE_TAG
89+
docker push $DOCKER_REPOSITORY:latest

0 commit comments

Comments
 (0)