@@ -3,31 +3,17 @@ name: Build and Upload Data Management App
33on :
44 release :
55 types : [created]
6- workflow_dispatch :
7- inputs :
8- branch :
9- description : ' Branch to build the app from'
10- required : false
11- default : ' main'
12- tag_name :
13- description : ' Tag to apply to the built artifact'
14- required : true
156
167jobs :
178 build :
189 runs-on : ubuntu-latest
1910
2011 steps :
21- - name : Determine ref
22- id : determine_ref
23- run : |
24- echo "ref=${{ github.event.release.tag_name || github.event.inputs.branch || 'main' }}" >> $GITHUB_OUTPUT
25-
2612 - name : Checkout Data Management App Repo
2713 uses : actions/checkout@v4
2814 with :
2915 repository : hydroserver2/hydroserver-data-management-app
30- ref : ${{ steps.determine_ref.outputs.ref }}
16+ ref : ${{ github.event.release.tag_name }}
3117 path : data_mgmt
3218
3319 - name : Setup Node 18.x
4531 working-directory : ./data_mgmt
4632 run : |
4733 cat << EOF > .env
48- VITE_APP_VERSION=${{ github.event.release.tag_name || github.event.inputs.tag_name }}
34+ VITE_APP_VERSION=${{ github.event.release.tag_name }}
4935 VITE_APP_GOOGLE_MAPS_API_KEY=${{ secrets.GOOGLE_MAPS_API_KEY }}
5036 VITE_APP_GOOGLE_MAPS_MAP_ID=${{ secrets.GOOGLE_MAPS_MAP_ID }}
5137 VITE_APP_PROXY_BASE_URL=${{ vars.PROXY_BASE_URL }}
@@ -55,15 +41,31 @@ jobs:
5541 working-directory : ./data_mgmt
5642 run : npm run build
5743
58- - name : Upload versioned artifact
59- uses : actions/upload-artifact@v3
44+ - name : Create ZIP archive of build
45+ working-directory : ./data_mgmt
46+ run : |
47+ zip -r data-management-app-${{ github.event.release.tag_name }}.zip dist
48+
49+ - name : Upload build artifact
50+ uses : actions/upload-artifact@v4
51+ with :
52+ name : data-management-app-${{ github.event.release.tag_name }}
53+ path : ./data_mgmt/data-management-app-${{ github.event.release.tag_name }}.zip
54+
55+ upload :
56+ needs : build
57+ runs-on : ubuntu-latest
58+
59+ steps :
60+ - name : Download build artifact
61+ uses : actions/download-artifact@v4
6062 with :
61- name : data-management-app-${{ github.event.release.tag_name || github.event.inputs.tag_name }}
62- path : ./data_mgmt/dist
63+ name : data-management-app-${{ github.event.release.tag_name }}
6364
64- - name : Upload latest artifact
65- if : ${{ github.event_name == 'release' }}
66- uses : actions/upload-artifact@v3
65+ - name : Upload Release Asset
66+ uses : actions/upload-release-asset@v1
6767 with :
68- name : data-management-app-latest
69- path : ./data_mgmt/dist
68+ upload_url : ${{ github.event.release.upload_url }}
69+ asset_path : " data-management-app-${{ github.event.release.tag_name }}.zip"
70+ asset_name : " data-management-app-${{ github.event.release.tag_name }}.zip"
71+ asset_content_type : application/zip
0 commit comments