-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (93 loc) · 2.95 KB
/
Copy pathtag.yml
File metadata and controls
105 lines (93 loc) · 2.95 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: deploy-aws-autoscaler
on:
push:
tags:
- v*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REGISTRY: ${{ secrets.REGISTRY }}
AWS_ACCESSKEY: ${{ secrets.AWS_ACCESSKEY }}
AWS_PROFILE: ${{ secrets.AWS_PROFILE }}
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_SECRETKEY: ${{ secrets.AWS_SECRETKEY }}
IAM_ROLE_ARN: ${{ secrets.IAM_ROLE_ARN }}
PRIVATE_DOMAIN_NAME: ${{ secrets.PRIVATE_DOMAIN_NAME }}
ROUTE53_ZONEID: ${{ secrets.ROUTE53_ZONEID }}
SEED_IMAGE: ${{ secrets.SEED_IMAGE }}
SEED_USER: ${{ secrets.SEED_USER }}
SSH_KEYNAME: ${{ secrets.SSH_KEYNAME }}
SSH_PRIVATEKEY: ${{ secrets.SSH_PRIVATEKEY }}
VPC_SECURITY_GROUPID: ${{ secrets.VPC_SECURITY_GROUPID }}
VPC_SUBNET_ID: ${{ secrets.VPC_SUBNET_ID }}
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache vendor
uses: actions/cache@v3
env:
cache-name: cache-vendor
with:
path: vendor
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('go.sum') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
- name: test-in-docker
shell: bash
run: |
./scripts/test.sh
deploy:
name: Deploy
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache vendor
uses: actions/cache@v3
env:
cache-name: cache-vendor
with:
path: vendor
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('go.sum') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
- name: Setup Go environment
uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Prepare docker buildx
id: prep
shell: bash
run: |
IMAGE_TAG=${GITHUB_REF#refs/tags/}
echo "tag=${IMAGE_TAG}" >> $GITHUB_OUTPUT
docker buildx version;
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin;
docker context create builders
- name: Setup docker buildx
uses: docker/setup-buildx-action@v2.2.1
with:
version: latest
endpoint: builders
use: true
- name: Build docker image
id: build
shell: bash
run: |
IMAGE_TAG=${GITHUB_REF#refs/tags/}
make -e REGISTRY=$REGISTRY -e TAG="${IMAGE_TAG}" container-push-manifest
sudo chown -R $USER out vendor
cp out/linux/amd64/aws-autoscaler aws-autoscaler-amd64
cp out/linux/arm64/aws-autoscaler aws-autoscaler-arm64
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.prep.outputs.tag }}
draft: false
files: |
aws-autoscaler-amd64
aws-autoscaler-arm64