MMA prod Ci/Cd #32
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
name: MMA prod Ci/Cd | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
defaults: | |
run: | |
working-directory: ./ | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'corretto' | |
cache: gradle | |
- name: Cache | |
uses: actions/[email protected] | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | |
- name: Build with Gradle | |
uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25 # v2.6.0 | |
with: | |
arguments: build | |
- name: Upload a Build Artifact | |
uses: actions/[email protected] | |
with: | |
name: mma.jar | |
path: build/libs/mma-*-SNAPSHOT.jar | |
deploy: | |
runs-on: self-hosted | |
needs: build | |
steps: | |
- name: Remove old jar file | |
run: rm -rf /home/ubuntu/mma/*.jar | |
- name: Download a Build Artifact | |
uses: actions/[email protected] | |
with: | |
name: mma.jar | |
path: /home/ubuntu/mma | |
- name: Add Permission | |
run: chmod +x /home/ubuntu/mma/*.jar | |
- name: Run sh | |
run: sudo /home/ubuntu/mma/run.sh |