-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (59 loc) · 2.35 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
name: Release build
# Original source: https://github.com/Bookshelf-Writer/scripts-for-integration/blob/main/workflows/Example-Build.yml
# When integrating, actions must have write permissions
on:
release:
branches:
- 'main'
types: [created]
jobs:
build:
name: "Build [${{ matrix.os }}]"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
go-version: [1.22.5]
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
########################################################################################################################
- name: Load Info from Build
if: ${{ matrix.os != 'windows-latest' }}
run: |
nameBuild=$(./_run/scripts/sys.sh -n)
versionBuild=$(./_run/scripts/sys.sh -v)
echo "BUILD_NAME=$nameBuild" >> $GITHUB_ENV
echo "BUILD_VER=$versionBuild" >> $GITHUB_ENV
echo "NAME: $nameBuild"
echo "VER: $versionBuild"
- name: Check Tag [linux]
if: ${{ matrix.os != 'windows-latest'}}
run: |
if [[ "${{ github.event.release.tag_name }}" != "${{ env.BUILD_VER }}" ]]; then
curl -X DELETE -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/releases/${{ github.event.release.id }}"
echo "::error ::Incorrect release tag. Should match the [${{ env.BUILD_VER }}]."
exit 1
fi
########################################################################################################################
- name: Push new version [linux]
if: ${{ matrix.os == 'ubuntu-latest'}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
new_version=$(./_run/scripts/sys.sh --increment --minor)
git add ./_run/values/ver.txt
git commit -m "actions [$new_version] "$'\n'"Build: [${{ env.BUILD_VER }}] >> [$new_version]"
git push origin HEAD:main