-
Notifications
You must be signed in to change notification settings - Fork 1
50 lines (45 loc) · 1.6 KB
/
main.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
name: Deploy Application
on:
push:
branches:
- master
jobs:
build:
name: publish tag
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Generate Git Tag
id: generate_tag
run: |
VERSION_PREFIX="v"
VERSION_MAJOR_MINOR="5.0"
VERSION_PATCH=$(git tag --list "${VERSION_PREFIX}${VERSION_MAJOR_MINOR}.*" --sort=-version:refname | head -n 1 | grep -oE '[0-9]+$')
if [ -z "$VERSION_PATCH" ]; then
VERSION_PATCH=0
else
VERSION_PATCH=$((VERSION_PATCH + 1))
fi
NEW_TAG="${VERSION_PREFIX}${VERSION_MAJOR_MINOR}.${VERSION_PATCH}"
echo "Generated new tag: $NEW_TAG"
echo "NEW_TAG=$NEW_TAG" >> $GITHUB_ENV
- name: Push Git Tag
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git tag $NEW_TAG
git push origin $NEW_TAG
- name: read formula config file
run: |
url="https://github.com/wswenyue/aklog/archive/${NEW_TAG}.tar.gz"
sha256=$(wget -O aklog.tar.gz ${url} && shasum -a 256 aklog.tar.gz | cut -d ' ' -f 1)
echo "url==>${url}"
echo "sha256==>${sha256}"
rm -rf ./aklog.tar.gz
en_url=`echo $url |sed 's#\/#\\\/#g'`
sed -e "s/#_url_#/${en_url}/g; s/#_sha256_#/${sha256}/g" .github/data/aklog.rb > .github/data/aklog.rb
content=$(cat .github/data/aklog.rb)
echo $content