1+
2+ # This worklflow will perform following actions when a release is published:
3+ # - Fetch Latest release.
4+ # - Build the latest docker image in production.
5+ # - Build release and commit to repo.
6+ # - Push the docker image to Github Artifact Registry-Prod.
7+ # - Rollout latest docker image to GKE.
8+ #
9+ # Maintainers:
10+ # - name: Nisha Sharma
11+ # - email: nisha.sharma@uni-jena.de
12+
13+ name : Build and Deploy to Prod
14+
15+ on :
16+ push :
17+ branches : [prod-helm-deploy]
18+
19+ env :
20+ DEPLOYMENT_NAME : nmrxiv-nmrium
21+ DOCKER_HUB_USERNAME : ${{ secrets.DOCKER_HUB_USERNAME }}
22+ DOCKER_HUB_PASSWORD : ${{ secrets.DOCKER_HUB_PASSWORD }}
23+ REPOSITORY_NAME : nmrium-react-wrapper
24+ REPOSITORY_NAMESPACE : nfdi4chem
25+
26+ jobs :
27+ setup-build-publish-deploy-prod :
28+ name : Deploy to prod
29+ if : github.ref == 'refs/heads/prod-helm-deploy'
30+ runs-on : ubuntu-latest
31+ steps :
32+ - name : Checkout
33+ uses : actions/checkout@v4.1.7
34+
35+ # Login to Docker Hub
36+ - name : Log in to Docker Hub
37+ uses : docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
38+ with :
39+ username : ${{ env.DOCKER_HUB_USERNAME }}
40+ password : ${{ env.DOCKER_HUB_PASSWORD }}
41+
42+ # Fetch latest release
43+ - name : Fetch latest release
44+ id : fetch-latest-release
45+ uses : InsonusK/get-latest-release@v1.1.0
46+ with :
47+ myToken : ${{ github.token }}
48+ exclude_types : " draft|prerelease"
49+ view_top : 10
50+ - name : " Print release name"
51+ run : |
52+ echo "tag_name: ${{ steps.fetch-latest-release.outputs.tag_name }}"
53+
54+ # Build and push Docker image to Docker Hub
55+ - name : Build and push Docker image
56+ uses : docker/build-push-action@v4
57+ with :
58+ context : .
59+ file : ./Dockerfile.prod
60+ push : true
61+ build-args : |
62+ RELEASE_VERSION=${{ steps.fetch-latest-release.outputs.tag_name }}
63+ tags : ${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:${{ steps.fetch-latest-release.outputs.tag_name }}, ${{ env.REPOSITORY_NAMESPACE }}/${{ env.REPOSITORY_NAME }}:latest
64+ username : ${{ env.DOCKER_HUB_USERNAME }}
65+ password : ${{ env.DOCKER_HUB_PASSWORD }}
66+
67+ # Build npm for release
68+ - name : Build npm
69+ run : |-
70+ npm install
71+ npm run build -- --outDir=build
72+ npm run build -- --outDir=releases/${{ steps.fetch-latest-release.outputs.tag_name }}
73+
74+ # Commit
75+ - name : Commit to repo
76+ uses : EndBug/add-and-commit@v9.1.4
77+ with :
78+ default_author : github_actions
0 commit comments