Build and deploy by @phyohtetarkar #7
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: Buid & Deploy (Native) | |
run-name: Build and deploy by @${{ github.actor }} | |
on: workflow_dispatch | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup GraalVM | |
uses: graalvm/setup-graalvm@v1 | |
with: | |
java-version: '21' | |
distribution: 'graalvm' | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create env file | |
run: | | |
touch env.production.yml | |
echo app.firebase.jwk-set-uri: ${{ secrets.JWK_SET_URI }} >> env.production.yml | |
echo app.firebase.issuer-uri: ${{ secrets.ISSUER_URI }} >> env.production.yml | |
mv env.production.yml marketplace-application/src/main/resources | |
- name: Build with Maven | |
run: mvn -Pnative package | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: application artifacts | |
path: marketplace-application/target/marketplace-application | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: application artifacts | |
path: marketplace-application/target/marketplace-application | |
- name: Upload to hosting | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.KEY }} | |
source: "marketplace-application/target/marketplace-application" | |
target: "/opt/marketplace/backend/tmp" | |
strip_components: 3 | |
overwrite: true | |
- name: Executing remote ssh commands | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.KEY }} | |
script: | | |
sudo systemctl stop marketplace-backend | |
mv /opt/marketplace/backend/tmp/marketplace-application /opt/marketplace/backend | |
chmod +x /opt/marketplace/backend/marketplace-application | |
sudo systemctl restart marketplace-backend |