-
-
Notifications
You must be signed in to change notification settings - Fork 107
46 lines (46 loc) · 1.41 KB
/
docker-cloud.yml
File metadata and controls
46 lines (46 loc) · 1.41 KB
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
name: docker-cloud go tests
on: [push]
defaults:
run:
working-directory: docker-cloud
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version-file: "docker-cloud/go.mod"
cache-dependency-path: "docker-cloud/go.sum"
cache: true
- name: Build
run: go build -v ./...
- name: Test
run: go test -v ./...
publish:
needs: test
permissions:
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::464590638146:role/GitHubActionECRPublicPushImage
aws-region: us-east-1
- name: Login to Amazon ECR Public
id: login-ecr-public
uses: aws-actions/amazon-ecr-login@v1
with:
registry-type: public
- name: Build, tag, and push docker image to Amazon ECR Public
env:
REGISTRY: ${{ steps.login-ecr-public.outputs.registry }}
REGISTRY_ALIAS: w0k4j6h5
REPOSITORY: immersive-go-course/docker-cloud
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG .
docker push $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG