-
Notifications
You must be signed in to change notification settings - Fork 0
163 lines (145 loc) · 4.73 KB
/
release.yaml
File metadata and controls
163 lines (145 loc) · 4.73 KB
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
'on':
push:
branches:
- '**' # All branches
tags:
- '*'
pull_request:
branches:
- main
- master
jobs:
test-and-build:
if: github.event_name == 'push' && !contains(github.ref, 'refs/tags/') && !contains(github.ref, 'refs/heads/main') && !contains(github.ref, 'refs/heads/master')
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
cache: gradle
- uses: gradle/actions/setup-gradle@v4
- name: run tests
run: |
echo "Running tests on branch push..."
cd assets && go test -v ./...
- name: build
run: |
VERSION="0.0.0-$(git rev-parse --short HEAD)"
echo "Building with version: $VERSION"
VERSION="$VERSION" ./gradlew makePackages
build:
if: (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')) || github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
cache: gradle
- uses: gradle/actions/setup-gradle@v4
- name: build
run: |
VERSION="0.0.0-$(git rev-parse --short HEAD)"
echo "Building on main/master merge with version: $VERSION"
VERSION="$VERSION" ./gradlew makePackages
upload:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
cache: gradle
- uses: gradle/actions/setup-gradle@v4
- name: build
env:
VERSION: ${{ github.ref_name }}
run: ./gradlew makePackages
- name: release
uses: softprops/action-gh-release@v1
with:
files: build/generated/pkl/packages/*
- name: create docs
env:
VERSION_NUM: ${{ github.ref_name }}
run: |
# Extract version number without the leading 'v'
export VERSION=$(echo "${VERSION_NUM}" | sed -E 's/^v(.*)$/\1/')
# Package URL from GitHub Releases
PACKAGE_URL="https://github.com/kdeps/schema/releases/download/${VERSION_NUM}/core@${VERSION}.zip"
echo "Waiting for package to be available at:"
echo " $PACKAGE_URL"
echo ""
# First, wait for the package to be downloadable
MAX_WAIT_RETRIES=10
WAIT_COUNT=0
WAIT_INTERVAL=30
while [ $WAIT_COUNT -lt $MAX_WAIT_RETRIES ]; do
echo "Checking if package is available (attempt $((WAIT_COUNT + 1))/$MAX_WAIT_RETRIES)..."
if curl --head --fail --silent "$PACKAGE_URL" > /dev/null 2>&1; then
echo "✅ Package is available!"
break
fi
WAIT_COUNT=$((WAIT_COUNT + 1))
if [ $WAIT_COUNT -lt $MAX_WAIT_RETRIES ]; then
echo "Package not yet available. Waiting ${WAIT_INTERVAL}s..."
sleep $WAIT_INTERVAL
else
echo "❌ Package not available after $MAX_WAIT_RETRIES attempts"
exit 1
fi
done
echo ""
echo "Generating documentation..."
# Retry pkldoc generation with backoff
MAX_RETRIES=3
RETRY_COUNT=0
WAIT_TIME=30
while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do
echo "Generating docs (attempt $((RETRY_COUNT + 1))/$MAX_RETRIES)..."
if ./gradlew pkldoc --stacktrace 2>&1 | tee /tmp/pkldoc.log; then
echo "✅ Documentation generated successfully!"
# Fix pkldoc index and create current symlink
./scripts/fix_pkldoc_index.sh
exit 0
fi
RETRY_COUNT=$((RETRY_COUNT + 1))
if [ $RETRY_COUNT -lt $MAX_RETRIES ]; then
echo "❌ Failed. Waiting ${WAIT_TIME}s before retry..."
sleep $WAIT_TIME
WAIT_TIME=$((WAIT_TIME * 2))
fi
done
echo "❌ Failed to generate docs after $MAX_RETRIES attempts"
echo "Last error log:"
cat /tmp/pkldoc.log
exit 1
- name: setup pages
uses: actions/configure-pages@v4
- name: upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: build/pkldoc/pkldoc
permissions:
contents: write
deploy-pages:
runs-on: ubuntu-latest
steps:
- id: deployment
name: deploy pages
uses: actions/deploy-pages@v4
needs: upload
permissions:
pages: write
id-token: write
environment:
name: pkl-docs
url: ${{ steps.deployment.outputs.page_url }}