-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (75 loc) · 2.52 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
name: release
on:
# Enable manual triggering of the workflow
workflow_dispatch:
push:
tags:
- 'v*' # This will trigger on tags starting with 'v', e.g., 'v1.0.0'
permissions:
contents: write
jobs:
setup:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
H_REPO: ${{ github.repository }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y gh gettext-base
- name: Get version
run: |
# Check if the workflow is triggered by a tag; if not, get the latest tag
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
# Remove the 'v' prefix and split the version string into components
version="${GITHUB_REF#refs/tags/v}"
else
# Fetch tags and get the latest one
git fetch --tags
version=$(git describe --tags $(git rev-list --tags --max-count=1))
version="${version#v}" # Remove 'v' prefix if the tag has it
fi
echo "VERSION=$version" >> $GITHUB_ENV
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build application
run: |
export VERSION
dotnet publish -c Release \
/p:Version=${VERSION} \
/p:FileVersion=${VERSION}.0 \
/p:AssemblyVersion=${VERSION}.0 \
/p:PublishSingleFile=true \
/p:SelfContained=true \
/p:RuntimeIdentifier=win-x64 \
/p:PublishTrimmed=true \
/p:DebugType=none \
--no-restore
- name: Create release notes
id: release_note
run: |
export VERSION
envsubst < comunicado.txt > comunicado.tmp
mv comunicado.tmp comunicado.txt
cat comunicado.txt
- name: Compress application
run: |
zip -r telbot.zip ./bin/Release/net7.0/win-x64/publish/ ./comunicado.txt
- name: Generate SHA256 checksum
run: |
sha256sum telbot.zip > telbot.zip.sha256sum
echo "SHA_WIN64_ZIP=$(cat telbot.zip.sha256sum)" >> $GITHUB_ENV
- name: Create a release on GitHub
run: |
export VERSION
gh release create v${VERSION} --verify-tag \
--notes-file comunicado.txt \
--title "TEL_BOT release v${VERSION}" \
telbot.zip telbot.zip.sha256sum