44# - Build release and commit to repo.
55# - Push the docker image to Github Artifact Registry-Prod.
66# - Rollout latest docker image to GKE.
7- #
7+ #
88# Maintainers:
99# - name: Nisha Sharma
1010# - email: nisha.sharma@uni-jena.de
1111
12- name : Build and Deploy to Prod
12+ name : Build and Deploy to Prod
1313
1414on :
1515 push :
1616 branches : [prod-helm-deploy]
1717
1818env :
1919 DEPLOYMENT_NAME : nmrxiv-nmrium
20- DOCKER_HUB_USERNAME : ${{ secrets.DOCKER_HUB_USERNAME }}
21- DOCKER_HUB_PASSWORD : ${{ secrets.DOCKER_HUB_PASSWORD }}
20+ DOCKER_HUB_USERNAME : ${{ secrets.DOCKER_HUB_USERNAME }}
21+ DOCKER_HUB_PASSWORD : ${{ secrets.DOCKER_HUB_PASSWORD }}
2222 REPOSITORY_NAME : nmrium-react-wrapper
2323 REPOSITORY_NAMESPACE : nfdi4chem
2424
@@ -30,61 +30,61 @@ jobs:
3030 environment :
3131 name : Production
3232 url : https://nmrium.nmrxiv.org
33-
33+
3434 steps :
35- - name : Checkout
36- uses : actions/checkout@v4.1.7
35+ - name : Checkout
36+ uses : actions/checkout@v4.1.7
37+
38+ # Login to Docker Hub
39+ - name : Log in to Docker Hub
40+ uses : docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
41+ with :
42+ username : ${{ env.DOCKER_HUB_USERNAME }}
43+ password : ${{ env.DOCKER_HUB_PASSWORD }}
44+
45+ # Fetch latest release
46+ - name : Fetch latest release
47+ id : fetch-latest-release
48+ uses : InsonusK/get-latest-release@v1.1.0
49+ with :
50+ myToken : ${{ github.token }}
51+ exclude_types : ' draft|prerelease'
52+ view_top : 10
53+ - name : ' Print release name'
54+ run : |
55+ echo "tag_name: ${{ steps.fetch-latest-release.outputs.tag_name }}"
3756
38- # Login to Docker Hub
39- - name : Log in to Docker Hub
40- uses : docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
41- with :
42- username : ${{ env.DOCKER_HUB_USERNAME }}
43- password : ${{ env.DOCKER_HUB_PASSWORD }}
44-
45- # Fetch latest release
46- - name : Fetch latest release
47- id : fetch-latest-release
48- uses : InsonusK/get-latest-release@v1.1.0
49- with :
50- myToken : ${{ github.token }}
51- exclude_types : " draft|prerelease"
52- view_top : 10
53- - name : " Print release name"
54- run : |
55- echo "tag_name: ${{ steps.fetch-latest-release.outputs.tag_name }}"
57+ # Build and push Docker image to Docker Hub
58+ - name : Build and push Docker image
59+ uses : docker/build-push-action@v4
60+ with :
61+ context : .
62+ file : ./Dockerfile.prod
63+ push : true
64+ build-args : |
65+ RELEASE_VERSION=${{ steps.fetch-latest-release.outputs.tag_name }}
66+ tags : ${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:${{ steps.fetch-latest-release.outputs.tag_name }}, ${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:latest
67+ username : ${{ env.DOCKER_HUB_USERNAME }}
68+ password : ${{ env.DOCKER_HUB_PASSWORD }}
5669
57- # Build and push Docker image to Docker Hub
58- - name : Build and push Docker image
59- uses : docker/build-push-action@v4
60- with :
61- context : .
62- file : ./Dockerfile.prod
63- push : true
64- build-args : |
65- RELEASE_VERSION=${{ steps.fetch-latest-release.outputs.tag_name }}
66- tags : ${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:${{ steps.fetch-latest-release.outputs.tag_name }}, ${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:latest
67- username : ${{ env.DOCKER_HUB_USERNAME }}
68- password : ${{ env.DOCKER_HUB_PASSWORD }}
70+ # Build npm for release
71+ - name : Clean and build npm
72+ run : |-
73+ echo "Cleaning node_modules and lock file to avoid native module issues..."
74+ rm -rf node_modules
75+ npm cache clean --force
6976
70- # Build npm for release
71- - name : Clean and build npm
72- run : |-
73- echo "Cleaning node_modules and lock file to avoid native module issues..."
74- rm -rf node_modules package-lock.json
75- npm cache clean --force
77+ echo "Installing dependencies..."
78+ npm install
7679
77- echo "Installing dependencies ..."
78- npm install
80+ echo "Building for main distribution ..."
81+ VITE_BUILD_OUT_DIR=dist npm run build
7982
80- echo "Building for main distribution... "
81- VITE_BUILD_OUT_DIR=dist npm run build
83+ echo "Building for release version: ${{ steps.fetch-latest-release.outputs.tag_name }} "
84+ VITE_BUILD_OUT_DIR=releases/${{ steps.fetch-latest-release.outputs.tag_name }} npm run build
8285
83- echo "Building for release version: ${{ steps.fetch-latest-release.outputs.tag_name }}"
84- VITE_BUILD_OUT_DIR=releases/${{ steps.fetch-latest-release.outputs.tag_name }} npm run build
85-
86- # Commit
87- - name : Commit to repo
88- uses : EndBug/add-and-commit@v9.1.4
89- with :
90- default_author : github_actions
86+ # Commit
87+ - name : Commit to repo
88+ uses : EndBug/add-and-commit@v9.1.4
89+ with :
90+ default_author : github_actions
0 commit comments