Skip to content

Commit d57bf94

Browse files
committed
update yml
1 parent d4c1666 commit d57bf94

File tree

1 file changed

+118
-213
lines changed

1 file changed

+118
-213
lines changed

.github/workflows/gh-pages.yml

Lines changed: 118 additions & 213 deletions
Original file line numberDiff line numberDiff line change
@@ -15,54 +15,52 @@ concurrency:
1515
cancel-in-progress: false
1616

1717
jobs:
18-
# build:
19-
# runs-on: ubuntu-latest
20-
# steps:
21-
# - name: Checkout
22-
# uses: actions/checkout@v3
23-
# - name: Set up Node.js
24-
# uses: actions/setup-node@v3
25-
# with:
26-
# node-version: '20'
27-
# - name: Install dependencies
28-
# run: npm install
29-
# - name: Build React app
30-
# run: npm run build:react
31-
# - name: Bundle the app with Webpack
32-
# run: npm run build:bundle
33-
# - name: List files in the build directory
34-
# run: ls -l ./build
35-
# - name: Upload artifact
36-
# uses: actions/upload-pages-artifact@v2
37-
# with:
38-
# name: github-pages
39-
# path: ./build
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v3
23+
- name: Set up Node.js
24+
uses: actions/setup-node@v3
25+
with:
26+
node-version: '20'
27+
- name: Install dependencies
28+
run: npm install
29+
- name: Build React app
30+
run: npm run build:react
31+
- name: Bundle the app with Webpack
32+
run: npm run build:bundle
33+
- name: List files in the build directory
34+
run: ls -l ./build
35+
- name: Upload artifact
36+
uses: actions/upload-pages-artifact@v2
37+
with:
38+
name: github-pages
39+
path: ./build
4040

41-
# deploy:
42-
# needs: build
43-
# runs-on: ubuntu-latest
44-
# steps:
45-
# - name: Checkout
46-
# uses: actions/checkout@v3
47-
# - name: Download artifact
48-
# uses: actions/download-artifact@v3
49-
# with:
50-
# name: github-pages
51-
# - name: List files after download
52-
# run: ls -l
53-
# - name: Deploy to GitHub Pages
54-
# uses: actions/deploy-pages@v1
55-
# with:
56-
# token: ${{ secrets.GITHUB_TOKEN }}
41+
deploy:
42+
needs: build
43+
runs-on: ubuntu-latest
44+
steps:
45+
- name: Checkout
46+
uses: actions/checkout@v3
47+
- name: Download artifact
48+
uses: actions/download-artifact@v3
49+
with:
50+
name: github-pages
51+
- name: List files after download
52+
run: ls -l
53+
- name: Deploy to GitHub Pages
54+
uses: actions/deploy-pages@v1
55+
with:
56+
token: ${{ secrets.GITHUB_TOKEN }}
5757

5858
build-gh-electron:
59-
# needs: deploy
59+
needs: deploy
6060
runs-on: ubuntu-latest
6161
strategy:
6262
matrix:
63-
# platform: [win]
6463
platform: [win, linux]
65-
# platform: [win, mac, linux]
6664
steps:
6765
- name: Checkout Code
6866
uses: actions/checkout@v3
@@ -113,9 +111,7 @@ jobs:
113111
runs-on: ubuntu-latest
114112
strategy:
115113
matrix:
116-
# platform: [win]
117114
platform: [win, linux]
118-
# platform: [win, mac, linux]
119115
steps:
120116
- name: Download Artifacts
121117
uses: actions/download-artifact@v3
@@ -153,17 +149,92 @@ jobs:
153149
file_list=$(IFS=','; echo "${files[*]}")
154150
echo "file_list=$file_list" >> $GITHUB_ENV
155151
156-
- name: Generate Release Assets
152+
- name: Upload Release Assets
157153
run: |
158-
echo "Files to upload: ${{ env.file_list }}"
159154
IFS=',' read -r -a file_array <<< "${{ env.file_list }}"
160155
for file in "${file_array[@]}"; do
161-
echo "$file" > asset_files.txt
162-
echo "Processing file: $file"
156+
echo "Uploading $file..."
157+
curl -XPOST \
158+
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
159+
-H "Content-Type: application/octet-stream" \
160+
--data-binary @$file \
161+
"https://uploads.github.com/repos/iDataVisualizationLab/TxDOT/releases/${{ steps.create_release.outputs.id }}/assets?name=$(basename $file)"
163162
done
164163
env:
165164
file_list: ${{ env.file_list }}
166165

166+
build-mac-electron:
167+
needs: release
168+
runs-on: macos-latest
169+
strategy:
170+
matrix:
171+
platform: [mac]
172+
steps:
173+
- name: Checkout Code
174+
uses: actions/checkout@v3
175+
- name: Install dependencies
176+
run: npm install
177+
- name: Install dmg-license
178+
run: npm install dmg-license
179+
- name: Build
180+
run: npm run build
181+
- name: Build Electron App
182+
run: |
183+
case ${{ matrix.platform }} in
184+
win) GH_TOKEN=${{ secrets.GITHUB_TOKEN }} npm run dist -- --win;;
185+
mac) GH_TOKEN=${{ secrets.GITHUB_TOKEN }} npm run dist -- --mac ;;
186+
linux) GH_TOKEN=${{ secrets.GITHUB_TOKEN }} npm run dist -- --linux AppImage ;;
187+
esac
188+
- name: Archive Build Outputs
189+
run: |
190+
mkdir -p artifacts
191+
case ${{ matrix.platform }} in
192+
win) mv dist/*.exe artifacts/ ;;
193+
mac) mv dist/*.dmg artifacts/ ;;
194+
linux) mv dist/*.AppImage artifacts/ ;;
195+
esac
196+
197+
- name: Upload Build Outputs
198+
uses: actions/upload-artifact@v3
199+
with:
200+
name: ${{ matrix.platform }}-builds
201+
path: artifacts
202+
203+
- name: List files in the build directory
204+
run: ls -l ./dist
205+
206+
- name: Extract version from package.json
207+
id: extract_version
208+
run: |
209+
VERSION=$(node -p "require('./package.json').version")
210+
echo "Version extracted: $VERSION"
211+
echo "::set-output name=version::$VERSION"
212+
echo "VERSION=$VERSION" >> $GITHUB_ENV
213+
214+
mac-release:
215+
needs: build-mac-electron
216+
runs-on: macos-latest
217+
strategy:
218+
matrix:
219+
platform: [mac]
220+
steps:
221+
- name: Download Artifacts
222+
uses: actions/download-artifact@v3
223+
with:
224+
name: ${{ matrix.platform }}-builds
225+
- name: Find All Files Matching VERSION
226+
id: find_files
227+
run: |
228+
VERSION=${{ env.VERSION }}
229+
files=($(ls ./*${VERSION}* 2>/dev/null || echo ""))
230+
if [ ${#files[@]} -eq 0 ]; then
231+
echo "Error: No files found matching VERSION ${VERSION}"
232+
exit 1
233+
fi
234+
echo "Found files: ${files[@]}"
235+
file_list=$(IFS=','; echo "${files[*]}")
236+
echo "file_list=$file_list" >> $GITHUB_ENV
237+
167238
- name: Upload Release Assets
168239
run: |
169240
IFS=',' read -r -a file_array <<< "${{ env.file_list }}"
@@ -178,172 +249,6 @@ jobs:
178249
env:
179250
file_list: ${{ env.file_list }}
180251

181-
# - name: Upload Release Assets
182-
# run: |
183-
# # Loop through the asset files and upload them one by one
184-
# for file in $(cat asset_files.txt); do
185-
# echo "Uploading $file..."
186-
# curl -XPOST \
187-
# -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
188-
# -H "Content-Type: application/octet-stream" \
189-
# --data-binary @$file \
190-
# "https://uploads.github.com/repos/iDataVisualizationLab/TxDOT/releases/${{ steps.create_release.outputs.id }}/assets?name=$file"
191-
# done
192-
193-
# - name: Upload Release Assets
194-
# id: upload-release-asset
195-
# uses: actions/upload-release-asset@v1
196-
# with:
197-
# upload_url: ${{ steps.create_release.outputs.upload_url }} # Use the upload URL from the create-release step
198-
# asset_path: ${{ env.file_list }} # Adjust the path if necessary
199-
# asset_name: ${{ env.VERSION }}-asset # Name of the asset to upload
200-
# asset_content_type: application/octet-stream
201-
# env:
202-
# VERSION: ${{ env.VERSION }}
203-
# file_list: ${{ env.file_list }}
204-
205-
206-
# - name: Upload Windows Installer
207-
# uses: actions/upload-release-asset@v1
208-
# with:
209-
# upload_url: ${{ steps.create_release.outputs.upload_url }}
210-
# asset_path: ./artifacts/*.exe
211-
# asset_name: TxCRCPME-win-v${{ github.run_number }}.exe
212-
# asset_content_type: application/octet-stream
213-
214-
# - name: Upload macOS Installer
215-
# uses: actions/upload-release-asset@v1
216-
# with:
217-
# upload_url: ${{ steps.create_release.outputs.upload_url }}
218-
# asset_path: ./artifacts/*.dmg
219-
# asset_name: TxCRCPME-mac-v${{ github.run_number }}.dmg
220-
# asset_content_type: application/octet-stream
221-
222-
# - name: Upload Linux Installer
223-
# uses: actions/upload-release-asset@v1
224-
# with:
225-
# upload_url: ${{ steps.create_release.outputs.upload_url }}
226-
# asset_path: ./artifacts/*.AppImage
227-
# asset_name: TxCRCPME-linux-v${{ github.run_number }}.AppImage
228-
# asset_content_type: application/octet-stream
229-
230-
231-
# build-mac-electron:
232-
# # needs: release
233-
# runs-on: macos-latest
234-
# strategy:
235-
# matrix:
236-
# platform: [mac]
237-
# steps:
238-
# - name: Checkout Code
239-
# uses: actions/checkout@v3
240-
# - name: Install dependencies
241-
# run: npm install
242-
# - name: Install dmg-license
243-
# run: npm install dmg-license
244-
# - name: Build
245-
# run: npm run build
246-
# - name: Build Electron App
247-
# run: |
248-
# case ${{ matrix.platform }} in
249-
# win) GH_TOKEN=${{ secrets.GITHUB_TOKEN }} npm run dist -- --win;;
250-
# mac) GH_TOKEN=${{ secrets.GITHUB_TOKEN }} npm run dist -- --mac ;;
251-
# linux) GH_TOKEN=${{ secrets.GITHUB_TOKEN }} npm run dist -- --linux AppImage ;;
252-
# esac
253-
# - name: Archive Build Outputs
254-
# run: |
255-
# mkdir -p artifacts
256-
# case ${{ matrix.platform }} in
257-
# win) mv dist/*.exe artifacts/ ;;
258-
# mac) mv dist/*.dmg artifacts/ ;;
259-
# linux) mv dist/*.AppImage artifacts/ ;;
260-
# esac
261-
262-
# - name: Upload Build Outputs
263-
# uses: actions/upload-artifact@v3
264-
# with:
265-
# name: ${{ matrix.platform }}-builds
266-
# path: artifacts
267-
268-
# - name: List files in the build directory
269-
# run: ls -l ./dist
270-
271-
# - name: Extract version from package.json
272-
# id: extract_version
273-
# run: |
274-
# VERSION=$(node -p "require('./package.json').version")
275-
# echo "Version extracted: $VERSION"
276-
# echo "::set-output name=version::$VERSION"
277-
# echo "VERSION=$VERSION" >> $GITHUB_ENV
278-
279-
# mac-release:
280-
# needs: build-mac-electron
281-
# runs-on: macos-latest
282-
# strategy:
283-
# matrix:
284-
# platform: [mac]
285-
# steps:
286-
# - name: Download Artifacts
287-
# uses: actions/download-artifact@v3
288-
# with:
289-
# name: ${{ matrix.platform }}-builds
290-
# - name: List files in the build directory
291-
# run: ls -l
292-
# - name: Debug VERSION
293-
# run: |
294-
# echo "VERSION is: ${{ env.VERSION }}"
295-
# env:
296-
# VERSION: ${{ env.VERSION }}
297-
# - name: Create GitHub Release
298-
# id: create_release
299-
# uses: actions/create-release@v1
300-
# env:
301-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
302-
# VERSION: ${{ env.VERSION }}
303-
# with:
304-
# tag_name: ${{ github.ref_name }}-${{ github.run_id }}
305-
# release_name: Release New Version ${{ env.VERSION }}
306-
# draft: false
307-
# prerelease: false
308-
309-
# - name: Find All Files Matching VERSION
310-
# id: find_files
311-
# run: |
312-
# VERSION=${{ env.VERSION }}
313-
# files=($(ls ./*${VERSION}* 2>/dev/null || echo ""))
314-
# if [ ${#files[@]} -eq 0 ]; then
315-
# echo "Error: No files found matching VERSION ${VERSION}"
316-
# exit 1
317-
# fi
318-
# echo "Found files: ${files[@]}"
319-
# file_list=$(IFS=','; echo "${files[*]}")
320-
# echo "file_list=$file_list" >> $GITHUB_ENV
321-
322-
# - name: Generate Release Assets
323-
# run: |
324-
# echo "Files to upload: ${{ env.file_list }}"
325-
# IFS=',' read -r -a file_array <<< "${{ env.file_list }}"
326-
# for file in "${file_array[@]}"; do
327-
# echo "$file" > asset_files.txt
328-
# echo "Processing file: $file"
329-
# done
330-
# env:
331-
# file_list: ${{ env.file_list }}
332-
333-
# - name: Upload Release Assets
334-
# run: |
335-
# IFS=',' read -r -a file_array <<< "${{ env.file_list }}"
336-
# for file in "${file_array[@]}"; do
337-
# echo "Uploading $file..."
338-
# curl -XPOST \
339-
# -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
340-
# -H "Content-Type: application/octet-stream" \
341-
# --data-binary @$file \
342-
# "https://uploads.github.com/repos/iDataVisualizationLab/TxDOT/releases/${{ steps.create_release.outputs.id }}/assets?name=$(basename $file)"
343-
# done
344-
# env:
345-
# file_list: ${{ env.file_list }}
346-
347252

348253

349254

0 commit comments

Comments
 (0)