-
Notifications
You must be signed in to change notification settings - Fork 8
116 lines (97 loc) · 3.22 KB
/
release.yml
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
106
107
108
109
110
111
112
113
114
115
116
name: Build and Release KDT
on:
push:
branches: [ master ]
jobs:
push_to_registry:
name: Build and Publish KDT
runs-on: ubuntu-latest
env:
IMAGE_NAME: 'kondukto/kondukto-cli'
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Add SHORT_SHA env property
id: set_short_sha_variable
run: |
echo "SHORT_SHA=`git rev-parse --short HEAD`" >> $GITHUB_ENV
- name: Get Last Tag
run: |
git fetch --prune --unshallow --tags
echo GIT_TAG=$(git describe --tags --abbrev=0) >> $GITHUB_ENV
- name: Get Version Tag
id: get_version_tag
run: |
echo "VERSION_TAG=${{ env.GIT_TAG }}" | cut -d '-' -f 1 >> $GITHUB_ENV
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: 1.22.x
cache: true
cache-dependency-path: ./go.sum
- name: Build and Show Version
id: build_and_show_version
run: |
make test
make test_coverage
make go.mod
make vet
make all
_release/kdt-linux-amd64 version
- name: Create Release
uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.VERSION_TAG }}
release_name: Release ${{ env.VERSION_TAG }}
prerelease: false
draft: true
body: |
Changes in release
- this
- name: Upload Release Assets
id: upload-release-assets
uses: dwenegar/upload-release-assets@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ steps.create_release.outputs.id }}
assets_path: ./_release/
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build/Push Tags
id: docker_build
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile
push: true
tags: |
${{ env.IMAGE_NAME }}:latest
${{ env.IMAGE_NAME }}:${{ env.VERSION_TAG }}
${{ env.IMAGE_NAME }}:${{ env.VERSION_TAG }}-${{ env.SHORT_SHA }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
- 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: eu-central-1
- name: Deploy to S3
run: |
aws s3 cp ./get.sh s3://${{ secrets.AWS_S3_BUCKET_ID }}/index.html
- name: Invalidate CDN
run: |
aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }} --paths "/*"