-
Notifications
You must be signed in to change notification settings - Fork 9
117 lines (113 loc) · 5.34 KB
/
create-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
117
name: update version and create new release
on:
push:
branches:
- master
paths-ignore:
- '.github/**'
- 'configs/**'
- 'testing-configs/**'
- '.gitignore'
- 'LICENSE'
- 'README.md'
- 'version'
jobs:
update_version:
name: Update Version
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.GH_TOKEN }}
- name: Increase Version
run: |
version=$(cat ./version | grep -o -e '[0-9]\{1,2\}\.[0-9]\{1,2\}\.[0-9]\{1,2\}')
major=$(echo "$version" | cut -d'.' -f1)
minor=$(echo "$version" | cut -d'.' -f2)
patch=$(echo "$version" | cut -d'.' -f3)
if [[ $patch -lt 99 ]]; then
((patch++))
elif [[ $minor -lt 99 ]]; then
patch=0
((minor++))
else
patch=0
minor=0
((major++))
fi
next_version="v$major.$minor.$patch"
echo "$next_version" >./version
- name: Create Github Output Env
id: version
run: |
version=$(cat ./version)
echo "VERSION=$version" >> $GITHUB_OUTPUT
- name: Push Change
run: |
git config --global user.name ShiranAvidov
git config --global user.email shiran.avidov@logz.io
git add ./version
git commit -m "update version"
git push
outputs:
VERSION: ${{ steps.version.outputs.VERSION }}
create_release:
name: Create Release
runs-on: ubuntu-latest
needs: update_version
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Update version file
run: |
echo "${{ needs.update_version.outputs.VERSION }}" >./version
- name: Push tag
run: |
git tag "${{ needs.update_version.outputs.VERSION }}"
git push origin "${{ needs.update_version.outputs.VERSION }}"
- name: Install zip
run: |
sudo apt-get install zip -y
- name: Create assets directory
run : |
mkdir assets
- name: Compress Windows Files
run: |
mkdir tmp
cd tmp
cp -r ${GITHUB_WORKSPACE}/scripts/windows/. ${GITHUB_WORKSPACE}/version .
zip -r ${GITHUB_WORKSPACE}/assets/agent_windows.zip .
rm -r ./*
cp -r ${GITHUB_WORKSPACE}/datasources/windows/. ${GITHUB_WORKSPACE}/resources .
zip -r ${GITHUB_WORKSPACE}/assets/windows_kubernetes_aks.zip kubernetes/aks resources
zip -r ${GITHUB_WORKSPACE}/assets/windows_kubernetes_eks.zip kubernetes/eks resources
zip -r ${GITHUB_WORKSPACE}/assets/windows_kubernetes_gke.zip kubernetes/gke resources
zip -r ${GITHUB_WORKSPACE}/assets/windows_kubernetes_digitalocean.zip kubernetes/digitalocean resources
zip -r ${GITHUB_WORKSPACE}/assets/windows_localhost_windows.zip localhost/windows resources
- name: Compress Linux Files
run: |
tar -czvf assets/agent_linux.tar.gz -C scripts/linux . -C ${GITHUB_WORKSPACE} version
tar -czvf assets/linux_kubernetes_aks.tar.gz -C datasources/linux kubernetes/aks -C ${GITHUB_WORKSPACE} resources -C ${GITHUB_WORKSPACE} resources-linux
tar -czvf assets/linux_kubernetes_eks.tar.gz -C datasources/linux kubernetes/eks -C ${GITHUB_WORKSPACE} resources -C ${GITHUB_WORKSPACE} resources-linux
tar -czvf assets/linux_kubernetes_gke.tar.gz -C datasources/linux kubernetes/gke -C ${GITHUB_WORKSPACE} resources -C ${GITHUB_WORKSPACE} resources-linux
tar -czvf assets/linux_kubernetes_digitalocean.tar.gz -C datasources/linux kubernetes/digitalocean -C ${GITHUB_WORKSPACE} resources -C ${GITHUB_WORKSPACE} resources-linux
tar -czvf assets/linux_aws_ec2.tar.gz -C datasources/linux aws/ec2 -C ${GITHUB_WORKSPACE} resources -C ${GITHUB_WORKSPACE} resources-linux
tar -czvf assets/linux_localhost_linux.tar.gz -C datasources/linux localhost/linux -C ${GITHUB_WORKSPACE} resources -C ${GITHUB_WORKSPACE} resources-linux
- name: Compress Mac Files
run: |
tar -czvf assets/agent_mac.tar.gz -C scripts/mac . -C ${GITHUB_WORKSPACE} version
tar -czvf assets/mac_kubernetes_aks.tar.gz -C datasources/mac kubernetes/aks -C ${GITHUB_WORKSPACE} resources -C ${GITHUB_WORKSPACE} resources-mac
tar -czvf assets/mac_kubernetes_eks.tar.gz -C datasources/mac kubernetes/eks -C ${GITHUB_WORKSPACE} resources -C ${GITHUB_WORKSPACE} resources-mac
tar -czvf assets/mac_kubernetes_gke.tar.gz -C datasources/mac kubernetes/gke -C ${GITHUB_WORKSPACE} resources -C ${GITHUB_WORKSPACE} resources-mac
tar -czvf assets/mac_kubernetes_digitalocean.tar.gz -C datasources/mac kubernetes/digitalocean -C ${GITHUB_WORKSPACE} resources -C ${GITHUB_WORKSPACE} resources-mac
tar -czvf assets/mac_localhost_mac.tar.gz -C datasources/mac localhost/mac -C ${GITHUB_WORKSPACE} resources -C ${GITHUB_WORKSPACE} resources-mac
- name: Create Release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ needs.update_version.outputs.VERSION }}
name: ${{ needs.update_version.outputs.VERSION }}
body: |
New Release ${{ needs.update_version.outputs.VERSION }}
artifacts: "assets/**"