-
Notifications
You must be signed in to change notification settings - Fork 336
155 lines (136 loc) · 4.87 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
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
name: Release to Github and Artifact
on:
workflow_dispatch:
push:
branches: [main]
paths:
- "version.json"
jobs:
upload_artifact:
name: upload_artifact
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Check out code
- name: Version convert
id: convert_version
run: |
version=$(jq -r '.version' version.json)
version_core=${version%%-*}
echo "VERSION=$version" >> $GITHUB_OUTPUT
echo "VERSION_CORE=$version_core" >> $GITHUB_OUTPUT
if [[ $version == *-* ]]; then
echo "rc release version"
echo "CHANNEL=dev" >> $GITHUB_OUTPUT
else
echo "release version"
echo "CHANNEL=release" >> $GITHUB_OUTPUT
fi
- name: Update CHANGELOG.md
id: update_data
run: |
changelog=$(cat changelog_latest.md)
echo "CHANGELOG<<EOF" >> $GITHUB_OUTPUT
echo "$changelog" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
current_date=$(date +%Y-%m-%d)
printf "## ${{ steps.convert_version.outputs.VERSION }} release on $current_date\n$changelog\n$(cat CHANGELOG.md)" > temp.txt
mv temp.txt CHANGELOG.md
- name: Create Zip Archive
run: |
mkdir websoft9 artifacts
cp -r docker websoft9
cp -r cockpit websoft9
cp -r scripts websoft9
cp -r install websoft9
cp -r docs websoft9
cp -r systemd websoft9
cp *.md websoft9
cp version.json websoft9
zip -r websoft9-${{ steps.convert_version.outputs.VERSION_CORE }}.zip websoft9
cp websoft9-${{ steps.convert_version.outputs.VERSION_CORE }}.zip artifacts
cp install/install.sh artifacts
cp version.json artifacts
cp CHANGELOG.md artifacts
cp artifacts/websoft9-${{ steps.convert_version.outputs.VERSION_CORE }}.zip artifacts/websoft9-latest.zip
- name: Upload To Azure Blob
uses: LanceMcCarthy/Action-AzureBlobUpload@v2
with:
connection_string: ${{ secrets.AZURE_STORAGE_ARTIFACT }}
container_name: ${{ steps.convert_version.outputs.CHANNEL }}
source_folder: artifacts/
destination_folder: ./websoft9
delete_if_exists: true
fail_if_source_empty: true
- name: Create Github Release
uses: softprops/action-gh-release@v1
with:
files: |
version.json
CHANGELOG.md
tag_name: ${{ steps.convert_version.outputs.VERSION }}
name: ${{ steps.convert_version.outputs.VERSION }}
body: ${{ steps.update_data.outputs.CHANGELOG }}
draft: false
prerelease: false
apidocs:
needs: upload_artifact
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
name: Check out code
- name: Get version
run: |
version=$(grep -Po '(?<=LABEL version=").*?(?=")' docker/apphub/Dockerfile)
echo $version
real_version=${version%%-*}
echo "VERSION=$version" >> $GITHUB_ENV
- name: Download redoc.standalone.js
run: wget -O apphub/apidocs/redoc.standalone.js https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js
- name: Run Docker container and get openapi.json
run: |
docker run -d --name apphub -p 8080:8080 websoft9dev/apphub:${{ env.VERSION }}
sleep 5
max_attempts=10
url="http://localhost:8080/openapi.json"
for attempt in $(seq 1 $max_attempts); do
echo "Attempt #$attempt to download $url..."
if wget -O apphub/apidocs/openapi.json "$url"; then
echo "Successfully downloaded $url"
break
else
echo "Failed to download $url. Waiting for 5 seconds before retry..."
sleep 5
fi
done
- name: Upload Websoft9 API to Azure
uses: bacongobbler/azure-blob-storage-upload@main
with:
source_dir: apphub/apidocs
container_name: $web
connection_string: ${{ secrets.Azure_blob }}
extra_args: '--destination-path ./apidocs'
overwrite: true
pages:
name: Build Github Pages
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
# Upload entire repository
path: '.'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v3