-
Notifications
You must be signed in to change notification settings - Fork 22
59 lines (50 loc) · 1.93 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
# name: Build and push image
# # Run action on both a push to the "develop" branch,
# # and when a Github release is created/edited/published
# on:
# push:
# branches:
# - develop
# paths:
# - 'coastlines/**'
# - '.github/workflows/docker.yaml'
# - 'Dockerfile'
# release:
# types: [created, edited, published]
# permissions:
# id-token: write # This is required for requesting the JWT
# contents: read # This is required for actions/checkout
# env:
# IMAGE_NAME: geoscienceaustralia/dea-coastlines
# jobs:
# push_ecr:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v3
# # If action is triggered by a release, push image to
# # Dockerhub using custom image tag extracted from the release
# - name: Get current version tag from release to use as image tag
# if: github.event_name == 'release'
# run: |
# echo "RELEASE=${GITHUB_REF/refs\/tags\/}" >> $GITHUB_ENV
# # If action is trigged by a push (not release), push a
# # latest/unstable image to Dockerhub using image tag based
# # on the most recent Github tag and commit hash
# - name: Get git commit hash for push to branch to use as image tag
# if: github.event_name != 'release'
# run: |
# git fetch --all --tags
# echo "RELEASE=$(git describe --tags)" >> $GITHUB_ENV
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# role-to-assume: arn:aws:iam::538673716275:role/github-actions-role
# aws-region: ap-southeast-2
# - name: Push image to ECR
# uses: whoan/docker-build-with-cache-action@master
# with:
# context: ./
# registry: 538673716275.dkr.ecr.ap-southeast-2.amazonaws.com
# image_name: ${{ env.IMAGE_NAME }}
# image_tag: latest,${{ env.RELEASE }}