forked from bcgov/startup-sample-project-aws-containers
-
Notifications
You must be signed in to change notification settings - Fork 1
37 lines (30 loc) · 1.05 KB
/
tag.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
name: Tag
on:
push:
tags: ["*"]
env:
IMAGE_ID: ${{ secrets.AWS_ECR_URI }}
jobs:
main:
name: main
runs-on: ubuntu-20.04
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-duration-seconds: 900
role-session-name: startup-sample-project-github-action
role-skip-session-tagging: true
- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v1
- name: Create Docker Tag
run: |
docker pull ${{ env.IMAGE_ID }}:${GITHUB_SHA}
docker tag ${{ env.IMAGE_ID }}:${GITHUB_SHA} ${{ env.IMAGE_ID }}:${GITHUB_REF#refs/tags/}
docker push ${{ env.IMAGE_ID }}:${GITHUB_REF#refs/tags/}