-
Notifications
You must be signed in to change notification settings - Fork 9
68 lines (64 loc) · 2.28 KB
/
tunnel-server.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
60
61
62
63
64
65
66
67
68
name: tunnel-server
on:
pull_request:
branches:
- master
push:
branches:
- master
tags:
- 'v*'
jobs:
tunnel-server:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
packages: write
steps:
- name: Set image tag
if: startsWith(github.ref, 'refs/tags/v')
run: echo "IMAGE_TAG=${GITHUB_REF#refs/tags/v}" | tee -a ${GITHUB_ENV}
- name: Checkout
uses: actions/checkout@v4
- name: Docker build
run: |
docker build \
-t aws-iot-secure-tunnel-server \
-f ./tunnel/cmd/secure-tunnel-server/Dockerfile .
- name: Login to GitHub Container Registry
if: startsWith(github.ref, 'refs/tags')
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push to GitHub Container Registry
if: startsWith(github.ref, 'refs/tags')
run: |
image=ghcr.io/${{ github.repository_owner }}/aws-iot-secure-tunnel-server
docker tag aws-iot-secure-tunnel-server ${image}:${IMAGE_TAG:-devel}
docker tag aws-iot-secure-tunnel-server ${image}:latest
docker push ${image}:${IMAGE_TAG:-devel}
docker push ${image}:latest
docker logout ghcr.io
- name: Configure AWS credentials
if: startsWith(github.ref, 'refs/tags')
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::610248501808:role/ci/GitHubActions-aws-iot-device-sdk-go
aws-region: us-east-1
- name: Login to Amazon ECR Public
if: startsWith(github.ref, 'refs/tags')
uses: aws-actions/amazon-ecr-login@v2
with:
registry-type: public
- name: Push to ECR public
if: startsWith(github.ref, 'refs/tags')
run: |
image=public.ecr.aws/${{ secrets.AWS_ECR_PUBLIC_ALIAS }}/aws-iot-secure-tunnel-server
docker tag aws-iot-secure-tunnel-server ${image}:${IMAGE_TAG:-devel}
docker tag aws-iot-secure-tunnel-server ${image}:latest
docker push ${image}:${IMAGE_TAG:-devel}
docker push ${image}:latest
docker logout public.ecr.aws