From e8cdc3e3e78ad8b5a61c83538d45e13f1357234f Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Mon, 15 Sep 2025 17:10:08 +0700 Subject: [PATCH 1/7] add deploy --- .forgejo/workflows/build.yaml | 50 ++++++++++++++++++++++++++++ .forgejo/workflows/ci-cd.yaml | 61 +++++++++++++++++++++++++++++++++++ .forgejo/workflows/deploy.yml | 29 +++++++++++++++++ 3 files changed, 140 insertions(+) create mode 100644 .forgejo/workflows/build.yaml create mode 100644 .forgejo/workflows/ci-cd.yaml create mode 100644 .forgejo/workflows/deploy.yml diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml new file mode 100644 index 000000000..e63417a02 --- /dev/null +++ b/.forgejo/workflows/build.yaml @@ -0,0 +1,50 @@ +# /.forgejo/workflows/build.yml +name: Build + +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+" + - "v[0-9]+.[0-9]+.[0-9]+*" + workflow_dispatch: + +env: + REGISTRY: ${{ vars.CONTAINER_REGISTRY }} + REGISTRY_USERNAME: ${{ vars.CONTAINER_REGISTRY_USERNAME }} + REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }} + CONTAINER_IMAGE_NAME: ${{ vars.CONTAINER_REGISTRY }}/${{ vars.CONTAINER_IMAGE_OWNER }}/${{ vars.CONTAINER_IMAGE_NAME }} + IMAGE_VERSION: build + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + with: + config-inline: | + [registry."${{ env.REGISTRY }}"] + ca=["/etc/ssl/certs/ca-certificates.crt"] + - name: Tag Version + run: | + if [[ "${{ github.event_name }}" == "push" ]]; then + echo "IMAGE_VERSION=${{ github.ref_name }}" | sed 's/v//g' >> $GITHUB_ENV + else + echo "IMAGE_VERSION=${{ env.IMAGE_VERSION }}-${{ github.run_number }}" >> $GITHUB_ENV + fi + - name: Login in to registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ env.REGISTRY_USERNAME }} + password: ${{ env.REGISTRY_PASSWORD }} + - name: Build and push docker image + uses: docker/build-push-action@v3 + with: + platforms: linux/amd64 + context: . + file: ./docker/Dockerfile + tags: ${{ env.CONTAINER_IMAGE_NAME }}:latest,${{ env.CONTAINER_IMAGE_NAME }}:${{ env.IMAGE_VERSION }} + push: true diff --git a/.forgejo/workflows/ci-cd.yaml b/.forgejo/workflows/ci-cd.yaml new file mode 100644 index 000000000..67b92e4b6 --- /dev/null +++ b/.forgejo/workflows/ci-cd.yaml @@ -0,0 +1,61 @@ +# /.forgejo/workflows/build.yml +name: Build + +on: + push: + tags: + - "dev[0-9]+.[0-9]+.[0-9]+" + - "dev[0-9]+.[0-9]+.[0-9]+*" + workflow_dispatch: + +env: + REGISTRY: ${{ vars.CONTAINER_REGISTRY }} + REGISTRY_USERNAME: ${{ vars.CONTAINER_REGISTRY_USERNAME }} + REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }} + CONTAINER_IMAGE_NAME: ${{ vars.CONTAINER_REGISTRY }}/${{ vars.CONTAINER_IMAGE_OWNER }}/${{ vars.CONTAINER_IMAGE_NAME }} + IMAGE_VERSION: build + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + with: + config-inline: | + [registry."${{ env.REGISTRY }}"] + ca=["/etc/ssl/certs/ca-certificates.crt"] + - name: Tag Version + run: | + if [[ "${{ github.event_name }}" == "push" ]]; then + echo "IMAGE_VERSION=${{ github.ref_name }}" | sed 's/dev//g' >> $GITHUB_ENV + else + echo "IMAGE_VERSION=${{ env.IMAGE_VERSION }}-${{ github.run_number }}" >> $GITHUB_ENV + fi + - name: Login in to registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ env.REGISTRY_USERNAME }} + password: ${{ env.REGISTRY_PASSWORD }} + - name: Build and push docker image + uses: docker/build-push-action@v3 + with: + platforms: linux/amd64 + context: . + file: ./docker/Dockerfile + tags: ${{ env.CONTAINER_IMAGE_NAME }}:latest,${{ env.CONTAINER_IMAGE_NAME }}:${{ env.IMAGE_VERSION }} + push: true + - name: Remote Deploy + uses: appleboy/ssh-action@v1.2.1 + with: + host: ${{ vars.SSH_DEPLOY_HOST }} + port: ${{ vars.SSH_DEPLOY_PORT }} + username: ${{ secrets.SSH_DEPLOY_USER }} + password: ${{ secrets.SSH_DEPLOY_PASSWORD }} + script: | + cd ~/repo + ./replace-env.sh APP_MGT "${{ env.IMAGE_VERSION }}" + ./deploy.sh hrms-mgt diff --git a/.forgejo/workflows/deploy.yml b/.forgejo/workflows/deploy.yml new file mode 100644 index 000000000..2e395ae1f --- /dev/null +++ b/.forgejo/workflows/deploy.yml @@ -0,0 +1,29 @@ +name: Build + +on: + workflow_dispatch: + inputs: + version: + description: "Version to deploy" + type: string + required: false + default: "latest" + +env: + IMAGE_VERSION: build + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Remote Deploy + uses: appleboy/ssh-action@v1.2.1 + with: + host: ${{ vars.SSH_DEPLOY_HOST }} + port: ${{ vars.SSH_DEPLOY_PORT }} + username: ${{ secrets.SSH_DEPLOY_USER }} + password: ${{ secrets.SSH_DEPLOY_PASSWORD }} + script: | + cd ~/repo + ./replace-env.sh APP_MGT "${{ inputs.version }}" + ./deploy.sh hrms-mgt From 65c489af307a1c9e1d8df51687a42ef1ca369cba Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Mon, 15 Sep 2025 17:15:14 +0700 Subject: [PATCH 2/7] fix ci cd --- .forgejo/workflows/ci-cd.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.forgejo/workflows/ci-cd.yaml b/.forgejo/workflows/ci-cd.yaml index 67b92e4b6..aef51eb64 100644 --- a/.forgejo/workflows/ci-cd.yaml +++ b/.forgejo/workflows/ci-cd.yaml @@ -3,9 +3,8 @@ name: Build on: push: - tags: - - "dev[0-9]+.[0-9]+.[0-9]+" - - "dev[0-9]+.[0-9]+.[0-9]+*" + branches: + - dev workflow_dispatch: env: From d156bceeb0ddff901622a0e70a6f25b4f8c900ea Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Mon, 15 Sep 2025 17:31:37 +0700 Subject: [PATCH 3/7] fix tag cicd --- .forgejo/workflows/ci-cd.yaml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.forgejo/workflows/ci-cd.yaml b/.forgejo/workflows/ci-cd.yaml index aef51eb64..df97a9a31 100644 --- a/.forgejo/workflows/ci-cd.yaml +++ b/.forgejo/workflows/ci-cd.yaml @@ -28,11 +28,7 @@ jobs: ca=["/etc/ssl/certs/ca-certificates.crt"] - name: Tag Version run: | - if [[ "${{ github.event_name }}" == "push" ]]; then - echo "IMAGE_VERSION=${{ github.ref_name }}" | sed 's/dev//g' >> $GITHUB_ENV - else - echo "IMAGE_VERSION=${{ env.IMAGE_VERSION }}-${{ github.run_number }}" >> $GITHUB_ENV - fi + echo "IMAGE_VERSION=latest" >> $GITHUB_ENV - name: Login in to registry uses: docker/login-action@v2 with: From 3fe855aa1b03f7fdc7569d1c2fda35672a4c7633 Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Tue, 16 Sep 2025 11:52:46 +0700 Subject: [PATCH 4/7] fix cicd noti --- .forgejo/workflows/ci-cd.yaml | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/.forgejo/workflows/ci-cd.yaml b/.forgejo/workflows/ci-cd.yaml index df97a9a31..b233e38a5 100644 --- a/.forgejo/workflows/ci-cd.yaml +++ b/.forgejo/workflows/ci-cd.yaml @@ -1,5 +1,5 @@ -# /.forgejo/workflows/build.yml -name: Build +# /.forgejo/workflows/ci-cd.yml +name: Build & Deploy on Dev on: push: @@ -12,7 +12,8 @@ env: REGISTRY_USERNAME: ${{ vars.CONTAINER_REGISTRY_USERNAME }} REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }} CONTAINER_IMAGE_NAME: ${{ vars.CONTAINER_REGISTRY }}/${{ vars.CONTAINER_IMAGE_OWNER }}/${{ vars.CONTAINER_IMAGE_NAME }} - IMAGE_VERSION: build + IMAGE_VERSION: latest + DISCORD_WEBHOOK: ${{ vars.DISCORD_WEBHOOK }} jobs: build: @@ -26,9 +27,8 @@ jobs: config-inline: | [registry."${{ env.REGISTRY }}"] ca=["/etc/ssl/certs/ca-certificates.crt"] - - name: Tag Version run: | - echo "IMAGE_VERSION=latest" >> $GITHUB_ENV + echo "IMAGE_VERSION=latest" - name: Login in to registry uses: docker/login-action@v2 with: @@ -54,3 +54,25 @@ jobs: cd ~/repo ./replace-env.sh APP_MGT "${{ env.IMAGE_VERSION }}" ./deploy.sh hrms-mgt + + - name: Discord Notification + if: always() + run: | + STATUS="${{ job.status == 'success' && '✅ Success' || '❌ Failed' }}" + COLOR="${{ job.status == 'success' && '3066993' || '15158332' }}" + TIMESTAMP=$(date -u +%Y-%m-%dT%H:%M:%SZ) + curl -H "Content-Type: application/json" \ + -X POST \ + -d "{ + \"embeds\": [{ + \"title\": \"$STATUS\", + \"description\": \"**Build & Deploy**\\n- Image: \`${{ env.CONTAINER_IMAGE_NAME }}\`\\n- Version: \`${{ env.IMAGE_VERSION }}\`\\n- By: \`${{ github.actor }}\`\", + \"color\": $COLOR, + \"footer\": { + \"text\": \"Release Notification\", + \"icon_url\": \"https://example.com/success-icon.png\" + }, + \"timestamp\": \"$TIMESTAMP\" + }] + }" \ + ${{ env.DISCORD_WEBHOOK }} From 398402f9ace5303c69a2f5b6b40d74c40983b6cd Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Tue, 16 Sep 2025 11:54:24 +0700 Subject: [PATCH 5/7] fix --- .forgejo/workflows/ci-cd.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.forgejo/workflows/ci-cd.yaml b/.forgejo/workflows/ci-cd.yaml index b233e38a5..4cc280867 100644 --- a/.forgejo/workflows/ci-cd.yaml +++ b/.forgejo/workflows/ci-cd.yaml @@ -27,6 +27,7 @@ jobs: config-inline: | [registry."${{ env.REGISTRY }}"] ca=["/etc/ssl/certs/ca-certificates.crt"] + - name: Tag Version run: | echo "IMAGE_VERSION=latest" - name: Login in to registry From 9ebbbdd20977cfafdac0def1070229049797447c Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Wed, 19 Nov 2025 13:12:53 +0700 Subject: [PATCH 6/7] fix:option Status --- src/modules/05_placement/views/04_helpGovernmentMain.vue | 2 +- src/modules/05_placement/views/05_repatriateMain.vue | 2 +- src/modules/05_placement/views/08_otherMain.vue | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/05_placement/views/04_helpGovernmentMain.vue b/src/modules/05_placement/views/04_helpGovernmentMain.vue index ff8f70751..f25af0cfc 100644 --- a/src/modules/05_placement/views/04_helpGovernmentMain.vue +++ b/src/modules/05_placement/views/04_helpGovernmentMain.vue @@ -276,7 +276,7 @@ onMounted(async () => { outlined dense label="สถานะ" - :options="store.statusOp.filter((item:any)=> item.id !== 'PENDING')" + :options="store.statusOp.filter((item:any)=> item.id !== 'PENDING' && item.id !== 'APPROVE'&& item.id !== 'REJECT')" emit-value map-options option-label="name" diff --git a/src/modules/05_placement/views/05_repatriateMain.vue b/src/modules/05_placement/views/05_repatriateMain.vue index d06584550..270a4efa9 100644 --- a/src/modules/05_placement/views/05_repatriateMain.vue +++ b/src/modules/05_placement/views/05_repatriateMain.vue @@ -248,7 +248,7 @@ onMounted(async () => { outlined dense label="สถานะ" - :options="store.statusOp.filter((item:any)=> item.id !== 'PENDING')" + :options="store.statusOp.filter((item:any)=> item.id !== 'PENDING' && item.id !== 'APPROVE'&& item.id !== 'REJECT')" emit-value map-options option-label="name" diff --git a/src/modules/05_placement/views/08_otherMain.vue b/src/modules/05_placement/views/08_otherMain.vue index dfc117935..a8acad511 100644 --- a/src/modules/05_placement/views/08_otherMain.vue +++ b/src/modules/05_placement/views/08_otherMain.vue @@ -339,7 +339,7 @@ onMounted(() => { outlined dense label="สถานะ" - :options="store.statusOp.filter((item:any)=> item.id !== 'PENDING')" + :options="store.statusOp.filter((item:any)=> item.id !== 'PENDING' && item.id !== 'APPROVE'&& item.id !== 'REJECT')" emit-value map-options option-label="name" From 070dc2d30fed3aa84229a146cd3f48f5e402dd7e Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Wed, 19 Nov 2025 13:23:08 +0700 Subject: [PATCH 7/7] fix --- .forgejo/workflows/build.yaml | 50 ---------------------- .forgejo/workflows/ci-cd.yaml | 79 ----------------------------------- .forgejo/workflows/deploy.yml | 29 ------------- 3 files changed, 158 deletions(-) delete mode 100644 .forgejo/workflows/build.yaml delete mode 100644 .forgejo/workflows/ci-cd.yaml delete mode 100644 .forgejo/workflows/deploy.yml diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml deleted file mode 100644 index e63417a02..000000000 --- a/.forgejo/workflows/build.yaml +++ /dev/null @@ -1,50 +0,0 @@ -# /.forgejo/workflows/build.yml -name: Build - -on: - push: - tags: - - "v[0-9]+.[0-9]+.[0-9]+" - - "v[0-9]+.[0-9]+.[0-9]+*" - workflow_dispatch: - -env: - REGISTRY: ${{ vars.CONTAINER_REGISTRY }} - REGISTRY_USERNAME: ${{ vars.CONTAINER_REGISTRY_USERNAME }} - REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }} - CONTAINER_IMAGE_NAME: ${{ vars.CONTAINER_REGISTRY }}/${{ vars.CONTAINER_IMAGE_OWNER }}/${{ vars.CONTAINER_IMAGE_NAME }} - IMAGE_VERSION: build - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - with: - config-inline: | - [registry."${{ env.REGISTRY }}"] - ca=["/etc/ssl/certs/ca-certificates.crt"] - - name: Tag Version - run: | - if [[ "${{ github.event_name }}" == "push" ]]; then - echo "IMAGE_VERSION=${{ github.ref_name }}" | sed 's/v//g' >> $GITHUB_ENV - else - echo "IMAGE_VERSION=${{ env.IMAGE_VERSION }}-${{ github.run_number }}" >> $GITHUB_ENV - fi - - name: Login in to registry - uses: docker/login-action@v2 - with: - registry: ${{ env.REGISTRY }} - username: ${{ env.REGISTRY_USERNAME }} - password: ${{ env.REGISTRY_PASSWORD }} - - name: Build and push docker image - uses: docker/build-push-action@v3 - with: - platforms: linux/amd64 - context: . - file: ./docker/Dockerfile - tags: ${{ env.CONTAINER_IMAGE_NAME }}:latest,${{ env.CONTAINER_IMAGE_NAME }}:${{ env.IMAGE_VERSION }} - push: true diff --git a/.forgejo/workflows/ci-cd.yaml b/.forgejo/workflows/ci-cd.yaml deleted file mode 100644 index 4cc280867..000000000 --- a/.forgejo/workflows/ci-cd.yaml +++ /dev/null @@ -1,79 +0,0 @@ -# /.forgejo/workflows/ci-cd.yml -name: Build & Deploy on Dev - -on: - push: - branches: - - dev - workflow_dispatch: - -env: - REGISTRY: ${{ vars.CONTAINER_REGISTRY }} - REGISTRY_USERNAME: ${{ vars.CONTAINER_REGISTRY_USERNAME }} - REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }} - CONTAINER_IMAGE_NAME: ${{ vars.CONTAINER_REGISTRY }}/${{ vars.CONTAINER_IMAGE_OWNER }}/${{ vars.CONTAINER_IMAGE_NAME }} - IMAGE_VERSION: latest - DISCORD_WEBHOOK: ${{ vars.DISCORD_WEBHOOK }} - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - with: - config-inline: | - [registry."${{ env.REGISTRY }}"] - ca=["/etc/ssl/certs/ca-certificates.crt"] - - name: Tag Version - run: | - echo "IMAGE_VERSION=latest" - - name: Login in to registry - uses: docker/login-action@v2 - with: - registry: ${{ env.REGISTRY }} - username: ${{ env.REGISTRY_USERNAME }} - password: ${{ env.REGISTRY_PASSWORD }} - - name: Build and push docker image - uses: docker/build-push-action@v3 - with: - platforms: linux/amd64 - context: . - file: ./docker/Dockerfile - tags: ${{ env.CONTAINER_IMAGE_NAME }}:latest,${{ env.CONTAINER_IMAGE_NAME }}:${{ env.IMAGE_VERSION }} - push: true - - name: Remote Deploy - uses: appleboy/ssh-action@v1.2.1 - with: - host: ${{ vars.SSH_DEPLOY_HOST }} - port: ${{ vars.SSH_DEPLOY_PORT }} - username: ${{ secrets.SSH_DEPLOY_USER }} - password: ${{ secrets.SSH_DEPLOY_PASSWORD }} - script: | - cd ~/repo - ./replace-env.sh APP_MGT "${{ env.IMAGE_VERSION }}" - ./deploy.sh hrms-mgt - - - name: Discord Notification - if: always() - run: | - STATUS="${{ job.status == 'success' && '✅ Success' || '❌ Failed' }}" - COLOR="${{ job.status == 'success' && '3066993' || '15158332' }}" - TIMESTAMP=$(date -u +%Y-%m-%dT%H:%M:%SZ) - curl -H "Content-Type: application/json" \ - -X POST \ - -d "{ - \"embeds\": [{ - \"title\": \"$STATUS\", - \"description\": \"**Build & Deploy**\\n- Image: \`${{ env.CONTAINER_IMAGE_NAME }}\`\\n- Version: \`${{ env.IMAGE_VERSION }}\`\\n- By: \`${{ github.actor }}\`\", - \"color\": $COLOR, - \"footer\": { - \"text\": \"Release Notification\", - \"icon_url\": \"https://example.com/success-icon.png\" - }, - \"timestamp\": \"$TIMESTAMP\" - }] - }" \ - ${{ env.DISCORD_WEBHOOK }} diff --git a/.forgejo/workflows/deploy.yml b/.forgejo/workflows/deploy.yml deleted file mode 100644 index 2e395ae1f..000000000 --- a/.forgejo/workflows/deploy.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Build - -on: - workflow_dispatch: - inputs: - version: - description: "Version to deploy" - type: string - required: false - default: "latest" - -env: - IMAGE_VERSION: build - -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - name: Remote Deploy - uses: appleboy/ssh-action@v1.2.1 - with: - host: ${{ vars.SSH_DEPLOY_HOST }} - port: ${{ vars.SSH_DEPLOY_PORT }} - username: ${{ secrets.SSH_DEPLOY_USER }} - password: ${{ secrets.SSH_DEPLOY_PASSWORD }} - script: | - cd ~/repo - ./replace-env.sh APP_MGT "${{ inputs.version }}" - ./deploy.sh hrms-mgt