Update build.yml
This commit is contained in:
22
.github/workflows/build.yml
vendored
22
.github/workflows/build.yml
vendored
@@ -9,7 +9,10 @@ on:
|
|||||||
- main
|
- main
|
||||||
env:
|
env:
|
||||||
APP_NAME: desa-darmasaba
|
APP_NAME: desa-darmasaba
|
||||||
|
APP_VERSION: ${{ github.sha }}---$(date +%Y%m%d%H%M%S)
|
||||||
WA_PHONE: 6289697338821
|
WA_PHONE: 6289697338821
|
||||||
|
EMAIL_FROM: bip.production.js@gmail.com
|
||||||
|
EMAIL_TO: kurosakiblackangel@gmail.com
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@@ -35,7 +38,7 @@ jobs:
|
|||||||
# Kirim notifikasi ke API build Start
|
# Kirim notifikasi ke API build Start
|
||||||
- name: Notify start build
|
- name: Notify start build
|
||||||
run: |
|
run: |
|
||||||
curl -X GET "https://wa.wibudev.com/code?text=build-start-desa-darmasaba&nom=${{ env.WA_PHONE }}"
|
curl -X GET "https://wa.wibudev.com/code?text=build-start-${{ env.APP_NAME }}&nom=${{ env.WA_PHONE }}"
|
||||||
|
|
||||||
# Checkout kode sumber
|
# Checkout kode sumber
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
@@ -73,11 +76,6 @@ jobs:
|
|||||||
- name: Build project
|
- name: Build project
|
||||||
run: bun run build >> build.txt 2>&1
|
run: bun run build >> build.txt 2>&1
|
||||||
|
|
||||||
# Generate unique version directory
|
|
||||||
- name: Generate version directory
|
|
||||||
id: version
|
|
||||||
run: echo "VERSION=${{ github.sha }}---v$(date +%Y%m%d%H%M%S)" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
# Ensure project directory exists
|
# Ensure project directory exists
|
||||||
- name: Ensure /var/www/projects/${{ env.APP_NAME }} exists
|
- name: Ensure /var/www/projects/${{ env.APP_NAME }} exists
|
||||||
uses: appleboy/ssh-action@master
|
uses: appleboy/ssh-action@master
|
||||||
@@ -96,7 +94,7 @@ jobs:
|
|||||||
username: ${{ secrets.VPS_USERNAME }}
|
username: ${{ secrets.VPS_USERNAME }}
|
||||||
key: ${{ secrets.VPS_SSH_KEY }}
|
key: ${{ secrets.VPS_SSH_KEY }}
|
||||||
source: "."
|
source: "."
|
||||||
target: "/var/www/projects/${{ env.APP_NAME }}/releases/${{ env.VERSION }}"
|
target: "/var/www/projects/${{ env.APP_NAME }}/releases/${{ env.APP_VERSION }}"
|
||||||
|
|
||||||
# Kirim file .env ke server
|
# Kirim file .env ke server
|
||||||
- name: Upload .env to server
|
- name: Upload .env to server
|
||||||
@@ -106,19 +104,19 @@ jobs:
|
|||||||
username: ${{ secrets.VPS_USERNAME }}
|
username: ${{ secrets.VPS_USERNAME }}
|
||||||
key: ${{ secrets.VPS_SSH_KEY }}
|
key: ${{ secrets.VPS_SSH_KEY }}
|
||||||
source: ".env"
|
source: ".env"
|
||||||
target: "/var/www/projects/desa-darmasaba/releases/${{ env.VERSION }}/.env"
|
target: "/var/www/projects/${{ env.APP_NAME }}/releases/${{ env.APP_VERSION }}/"
|
||||||
|
|
||||||
# Kirim notifikasi ke API jika build berhasil
|
# Kirim notifikasi ke API jika build berhasil
|
||||||
- name: Notify build success via API
|
- name: Notify build success via API
|
||||||
if: success()
|
if: success()
|
||||||
run: |
|
run: |
|
||||||
curl -X GET "https://wa.wibudev.com/code?text=finish-success&nom=6289697338821"
|
curl -X GET "https://wa.wibudev.com/code?text=finish-success-build-${{ env.APP_NAME }}&nom=6289697338821"
|
||||||
|
|
||||||
# Kirim notifikasi ke API jika build gagal
|
# Kirim notifikasi ke API jika build gagal
|
||||||
- name: Notify build failed via API
|
- name: Notify build failed via API
|
||||||
if: failure()
|
if: failure()
|
||||||
run: |
|
run: |
|
||||||
curl -X GET "https://wa.wibudev.com/code?text=finish-failed&nom=6289697338821"
|
curl -X GET "https://wa.wibudev.com/code?text=finish-failed-build-${{ env.APP_NAME }}&nom=6289697338821"
|
||||||
|
|
||||||
# Send email with GitHub Actions logs
|
# Send email with GitHub Actions logs
|
||||||
- name: Send email with logs
|
- name: Send email with logs
|
||||||
@@ -136,7 +134,7 @@ jobs:
|
|||||||
Branch: ${{ github.ref }}
|
Branch: ${{ github.ref }}
|
||||||
Commit: ${{ github.sha }}
|
Commit: ${{ github.sha }}
|
||||||
|
|
||||||
to: kurosakiblackangel@gmail.com
|
to: ${{ env.EMAIL_TO }}
|
||||||
from: bip.production.js@gmail.com
|
from: ${{ env.EMAIL_FROM }}
|
||||||
attachments: |
|
attachments: |
|
||||||
build.txt
|
build.txt
|
||||||
|
|||||||
Reference in New Issue
Block a user