generated from semicolondsm/Semicolon_Repository_Generator
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: add prod-build * chore: modify jdk version * chore: add _PROD postfix in env * Update prod-build.yaml
- Loading branch information
1 parent
1a4980f
commit 12fd62e
Showing
1 changed file
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
name: Build for Prod | ||
on: | ||
push: | ||
tags: | ||
- v*.*.* | ||
|
||
env: | ||
SERVICE_NAME: user | ||
SERVICE_TYPE: be | ||
|
||
jobs: | ||
build: | ||
environment: prod | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
java-version: [ 17 ] | ||
outputs: | ||
version: ${{ steps.get_version.outputs.BRANCH_NAME }} | ||
|
||
steps: | ||
- name: Check Out The Repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Java | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: ${{ matrix.java-version }} | ||
distribution: 'zulu' | ||
|
||
- name: Get the version | ||
id: get_version | ||
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3) | ||
|
||
- name: Gradle Build | ||
uses: gradle/gradle-build-action@v2 | ||
with: | ||
arguments: | | ||
build | ||
--no-daemon | ||
- name: Log in to Docker Hub | ||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | ||
with: | ||
username: ${{secrets.DOCKER_USER}} | ||
password: ${{secrets.DOCKER_HUB_TOKEN}} | ||
|
||
- name: Build and push Docker image | ||
id: docker_build | ||
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: true | ||
tags: ${{secrets.DOCKER_USER}}/${{env.SERVICE_NAME}}-${{env.SERVICE_TYPE}}:${{ steps.get_version.outputs.VERSION }} | ||
build-args: | | ||
DBMS=${{secrets.DBMS_PROD}} | ||
DB_HOST=${{secrets.DB_HOST_PROD}} | ||
DB_PORT=${{secrets.DB_PORT_PROD}} | ||
DB_NAME=${{secrets.DB_NAME_PROD}} | ||
DB_PASSWORD=${{secrets.DB_PASSWORD_PROD}} | ||
DB_USERNAME=${{secrets.DB_USERNAME_PROD}} | ||
SHOW_SQL=${{secrets.SHOW_SQL_PROD}} | ||
DDL_AUTO_MODE=${{secrets.DDL_AUTO_MODE_PROD}} | ||
DB_POOL=${{secrets.DB_POOL_PROD}} | ||
AUTHORITY_SERVICE_HOST=${{secrets.AUTHORITY_SERVICE_HOST}} | ||
- name: Repository Dispatch | ||
uses: peter-evans/repository-dispatch@v1 | ||
with: | ||
token: ${{ secrets.GITOPS_DEPLOY_PRODUCTION_TOKEN }} | ||
repository: team-xquare/xquare-gitops-repo-production | ||
event-type: update_image | ||
client-payload: '{ | ||
"ref": "${{ github.ref }}", | ||
"version": "${{ steps.get_version.outputs.VERSION }}", | ||
"service_name": "${{env.SERVICE_NAME}}", | ||
"service_type": "${{env.SERVICE_TYPE}}" | ||
}' |