-
Notifications
You must be signed in to change notification settings - Fork 33
212 lines (186 loc) · 6.16 KB
/
release-visualization.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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
name: Release - Visualization
on:
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 1.131.3)'
required: true
type: string
pull_request:
types:
- closed
branches:
- main
paths:
- 'visualization/**'
- 'gh-pages/_posts/release/*vis_*.md'
env:
VERSION: "0.0.0"
jobs:
# Build artifacts
build:
if: |
(github.event_name == 'workflow_dispatch') ||
(github.event_name == 'pull_request' &&
github.event.pull_request.merged == true &&
contains(github.event.pull_request.labels.*.name, 'release') &&
startsWith(github.event.pull_request.head.ref, 'release/vis-'))
name: Build
runs-on: ubuntu-latest
outputs:
version: ${{ env.VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set version
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "VERSION=${{ inputs.version }}" >> $GITHUB_ENV
else
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
echo "VERSION=${BRANCH_NAME#release/vis-}" >> $GITHUB_ENV
fi
- name: Create tag
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git tag "vis-${{ env.VERSION }}"
git push origin "vis-${{ env.VERSION }}"
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y wine-stable zip
- name: Enable analysis execution rights
working-directory: ./analysis
run: |
chmod +x ./gradlew
- name: Build visualization
env:
NODE_OPTIONS: "--max_old_space_size=4096"
working-directory: ./visualization
run: |
npm ci
npm run build
npm run package
# Debug step to verify files
- name: List build artifacts
run: |
echo "Contents of visualization/dist/packages:"
ls -la visualization/dist/packages/
echo "Found zip files:"
find visualization/dist/packages -name "*.zip"
# Upload build artifacts for other jobs
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: |
visualization/dist/packages
- name: Upload webpack
uses: actions/upload-artifact@v4
with:
name: webpack-build
path: |
visualization/dist/webpack
# Create GitHub Release
create_release:
needs: build
name: Create GitHub Release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
path: visualization/dist/packages
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Create Release
run: |
# Debug: List files
echo "Contents of packages directory:"
ls -la visualization/dist/packages/
CHANGELOG_CONTENT=$(bun script/version-manager.ts extract-changelog visualization ${{ needs.build.outputs.version }})
gh release create "vis-${{ needs.build.outputs.version }}" \
--title "Visualization release ${{ needs.build.outputs.version }}" \
--notes "$CHANGELOG_CONTENT" \
visualization/dist/packages/*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Publish to npm
publish_npm:
needs: build
name: Publish to npm
runs-on: ubuntu-latest
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: webpack-build
path: visualization/dist/webpack
- name: Publish package
working-directory: visualization
run: |
npm version ${{ needs.build.outputs.version }} --no-git-tag-version --allow-same-version
npm publish --tag latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# Publish to Docker Hub
publish_docker:
needs: build
name: Publish to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Pull and retag Docker image
run: |
docker pull codecharta/codecharta-visualization:staging
docker tag codecharta/codecharta-visualization:staging codecharta/codecharta-visualization:latest
docker tag codecharta/codecharta-visualization:staging codecharta/codecharta-visualization:${{ needs.build.outputs.version }}
docker push codecharta/codecharta-visualization:latest
docker push codecharta/codecharta-visualization:${{ needs.build.outputs.version }}
# Deploy to GitHub Pages
deploy_website:
needs: build
name: Deploy Website
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: webpack-build
path: visualization/dist/webpack
- name: Create Sample File for Web Demo
run: sh ./script/build_demo_file_visualization.sh
- name: Deploy to GitHub Pages
uses: JamesIves/[email protected]
with:
token: ${{ secrets.DEPLOY_TOKEN }}
branch: gh-pages
folder: visualization/dist/webpack
target-folder: visualization/app
clean: true