-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (118 loc) · 4.41 KB
/
pyinstaller-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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: Create Release
on:
push:
branches: [ release ]
pull_request:
branches: [ release ]
jobs:
release:
env:
GH_TOKEN: ${{ github.token }}
runs-on: ubuntu-latest # You can specify other OS like windows-latest if needed
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get the latest tag
id: get_tag
run: |
latest_tag=$(git describe --tags --abbrev=0)
echo "Latest tag: $latest_tag"
# Extract version number (assuming tags follow semantic versioning)
if [ -z "$latest_tag" ]; then
echo "::set-output name=new_tag::v1.0.0"
else
major=$(echo $latest_tag | cut -d. -f1 | sed 's/v//')
minor=$(echo $latest_tag | cut -d. -f2)
patch=$(echo $latest_tag | cut -d. -f3)
new_patch=$((patch + 1))
new_tag="v$major.$minor.$new_patch"
echo "::set-output name=new_tag::$new_tag"
fi
shell: bash
- name: Wait for Caches to Appear
id: wait-for-cache
run: |
max_attempts=40 # Maximum number of attempts
attempt=1
success=false
while [ $attempt -le $max_attempts ]; do
echo "Attempt $attempt: Checking for all caches..."
# Check for all caches
windows_cache=$(gh cache list --json key --jq ".[] | select(.key == \"windows-app-build-${{ github.ref_name }}-${{ github.sha }}\")")
linux_cache=$(gh cache list --json key --jq ".[] | select(.key == \"linux-amd64-app-build-${{ github.ref_name }}-${{ github.sha }}\")")
if [ -n "$windows_cache" ]; then
echo "Windows cache found."
fi
if [ -n "$linux_cache" ]; then
echo "Linux amd64 cache found."
fi
if [ -n "$windows_cache" ] && [ -n "$linux_cache" ]; then
echo "All caches found! Proceeding with build."
success=true
break
else
echo "One or more caches not found. Retrying in 30 seconds..."
sleep 30
fi
attempt=$(( attempt + 1 ))
done
if [ "$success" = false ]; then
echo "Caches not available after $max_attempts attempts. Exiting..."
exit 1
fi
- name: Restore Windows x64 From Cache
uses: actions/cache@v3
with:
path: ./dist/windows/
key: windows-app-build-${{ github.ref_name }}-${{ github.sha }}
enableCrossOsArchive: true
fail-on-cache-miss: true
- name: Restore Linux amd64 From Cache
uses: actions/cache@v3
with:
path: ./dist/linux_amd64/
key: linux-amd64-app-build-${{ github.ref_name }}-${{ github.sha }}
enableCrossOsArchive: true
fail-on-cache-miss: true
- name: Verify Restored Binaries
run: |
echo "Listing files in ./:"
ls -l ./
ls -l ./dist/linux_amd64/
ls -l ./dist/windows/
- name: Create Windows ZIP archive
run: |
zip -jr ./tritime-win64.zip ./dist/windows/
- name: Create Linux amd64 archive
run: |
cd dist/linux_amd64/ && tar -czvf ../../tritime-linux-amd64.tar.gz ./
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_tag.outputs.new_tag }}
release_name: Tritime ${{ steps.get_tag.outputs.new_tag }}
draft: false
prerelease: false
- name: Upload Windows Artifact to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./tritime-win64.zip
asset_name: tritime-win64.zip
asset_content_type: application/zip
- name: Upload Linux amd64 Artifact to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./tritime-linux-amd64.tar.gz
asset_name: tritime-linux-amd64.tar.gz
asset_content_type: application/tgz