-
Notifications
You must be signed in to change notification settings - Fork 15
49 lines (45 loc) · 1.75 KB
/
build_push.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
name: Build and push images
on:
push:
tags:
- '*'
env:
REGISTRY: gcr.io/fetch-ai-images
jobs:
build-and-push:
timeout-minutes: 30
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Get tag name
id: tag_name
run: |
echo ::set-output name=SOURCE_NAME::${GITHUB_REF#refs/*/}
echo ::set-output name=SOURCE_BRANCH::${GITHUB_REF#refs/heads/}
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
- name: Login to Docker hub, build and push
run: |
SHORTVERSION=${SOURCE_TAG%.*}
docker login --username ${{ secrets.DOCKER_USERNAME }} --password ${{ secrets.DOCKER_PASSWORD }}
docker build -t fetchai/cosmos-explorer:$SOURCE_TAG .
docker push fetchai/cosmos-explorer:$SOURCE_TAG
docker tag fetchai/cosmos-explorer:$SOURCE_TAG fetchai/cosmos-explorer:$SHORTVERSION
docker push fetchai/cosmos-explorer:$SHORTVERSION
env:
SOURCE_TAG: ${{ steps.tag_name.outputs.SOURCE_TAG }}
- name: Setup GCloud
uses: google-github-actions/setup-gcloud@v0
with:
service_account_key: ${{ secrets.GCLOUD_KEY_IMAGES }}
- name: Configure Docker
run: |
gcloud auth configure-docker
- name: Build and push to GCR
run: |
SHORTVERSION=${SOURCE_TAG%.*}
docker tag fetchai/cosmos-explorer:$SOURCE_TAG $REGISTRY/cosmos-explorer:$SOURCE_TAG
docker tag $REGISTRY/cosmos-explorer:$SOURCE_TAG $REGISTRY/cosmos-explorer:$SHORTVERSION
docker push $REGISTRY/cosmos-explorer:$SOURCE_TAG
docker push $REGISTRY/cosmos-explorer:$SHORTVERSION
env:
SOURCE_TAG: ${{ steps.tag_name.outputs.SOURCE_TAG }}