update for release
This commit is contained in:
parent
91f88b2aa6
commit
4edef450a3
7 changed files with 81 additions and 26 deletions
54
.github/workflows/release.yaml
vendored
54
.github/workflows/release.yaml
vendored
|
|
@ -1,11 +1,11 @@
|
|||
name: release
|
||||
run-name: remote-build ${{ github.actor }}
|
||||
run-name: release ${{ github.actor }}
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v[0-9]+.[0-9]+.[0-9]+'
|
||||
# tags-ignore:
|
||||
# - '2.*'
|
||||
tags-ignore:
|
||||
- '2.*'
|
||||
# Allow run workflow manually from Action tab
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
|
|
@ -15,14 +15,15 @@ on:
|
|||
env:
|
||||
REGISTRY: docker.frappet.com
|
||||
IMAGE_NAME: demo/qualifying-exam-cms
|
||||
# IMAGE_TAG: 0.2.1
|
||||
jobs:
|
||||
# export GITHUB_REF=refs/tags/v1.2.3
|
||||
# act workflow_dispatch --input IMAGE_VER=v0.2.1 -W .github/workflows/release.yaml -j release
|
||||
# act workflow_dispatch -W .github/workflows/release.yaml --input IMAGE_VER=v0.2.1-dev -s DOCKER_USER=sorawit -s DOCKER_PASS=P@ssword -s SSH_PASSWORD=P@ssw0rd
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Gen tags
|
||||
# https://thekevinwang.com/2022/06/13/github-actions-survival-skills/
|
||||
- name: Check out code # checkout only cms is possible but I checkout all
|
||||
uses: actions/checkout@v3
|
||||
- name: Gen Version
|
||||
id: gen_ver
|
||||
run: |
|
||||
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||
|
|
@ -33,8 +34,39 @@ jobs:
|
|||
if [[ $IMAGE_VER == '' ]]; then
|
||||
IMAGE_VER='beta'
|
||||
fi
|
||||
echo "{\"version\":\"$IMAGE_VER\", \"builddate\":\"$(date +"%Y-%m-%d_%T")\",\"ref_name\":\"$GITHUB_REF\" }" > ./cms/src/lib/ver.json
|
||||
cat ./cms/src/lib/ver.json
|
||||
echo '::set-output name=image_ver::'$IMAGE_VER
|
||||
- name: Test
|
||||
run: |
|
||||
echo $GITHUB_REF
|
||||
echo ${{ steps.gen_ver.outputs.image_ver }}
|
||||
# - name: Test Version
|
||||
# run: |
|
||||
# echo $GITHUB_REF
|
||||
# echo ${{ steps.gen_ver.outputs.image_ver }}
|
||||
# cat ./cms/src/lib/ver.json
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- name: Login in to registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{env.REGISTRY}}
|
||||
username: ${{secrets.DOCKER_USER}}
|
||||
password: ${{secrets.DOCKER_PASS}}
|
||||
- name: CMS Build and push docker image
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: cms
|
||||
# platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest
|
||||
- name: Remote Deployment
|
||||
uses: appleboy/ssh-action@v0.1.8
|
||||
with:
|
||||
host: frappet.com
|
||||
username: frappet
|
||||
password: ${{ secrets.SSH_PASSWORD }}
|
||||
port: 22
|
||||
script: |
|
||||
cd /home/frappet/docker/bma-ehr-recruit-qualifying-exam
|
||||
docker-compose pull
|
||||
docker-compose up -d
|
||||
touch success
|
||||
|
||||
|
|
|
|||
16
.github/workflows/remote-build.yaml
vendored
16
.github/workflows/remote-build.yaml
vendored
|
|
@ -3,12 +3,9 @@ run-name: remote-build ${{ github.actor }}
|
|||
on:
|
||||
# push:
|
||||
# tags:
|
||||
# - v1.**
|
||||
# branches:
|
||||
# - 'main'
|
||||
# branches:
|
||||
# - 'release-*'
|
||||
|
||||
# - 'v[0-9]+.[0-9]+.[0-9]+'
|
||||
# tags-ignore:
|
||||
# - '2.*'
|
||||
# Allow run workflow manually from Action tab
|
||||
workflow_dispatch:
|
||||
env:
|
||||
|
|
@ -31,9 +28,10 @@ jobs:
|
|||
registry: ${{env.REGISTRY}}
|
||||
username: ${{secrets.DOCKER_USER}}
|
||||
password: ${{secrets.DOCKER_PASS}}
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '18'
|
||||
# Node no need because use 2 state build
|
||||
# - uses: actions/setup-node@v3
|
||||
# with:
|
||||
# node-version: '18'
|
||||
- name: Build and push docker image
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
|
|
|
|||
14
cms/.dockerignore
Normal file
14
cms/.dockerignore
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# .dockerignore
|
||||
node_modules
|
||||
.vscode
|
||||
.git
|
||||
.gitignore
|
||||
.gitattributes
|
||||
.eslintignore
|
||||
.eslintrc.cjs
|
||||
.prettierrc
|
||||
.pretieriignore
|
||||
README.md
|
||||
Dockerfile
|
||||
docker-compose.yaml
|
||||
playwright.config.ts
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
- [Keycloak](https://www.keycloak.org/) ใช้สำหรับทำระบบ Login
|
||||
|
||||
## วีดีโอแสดงการทำงานทั้งหมด
|
||||
[](https://youtu.be/WNNDuRjBDd4 "Automate Development")
|
||||
[](https://youtu.be/7CER67WVWec "Automate Development")
|
||||
|
||||
ในวีดีโอลืมแสดงตัวอย่างการใช้ API
|
||||
|
||||
|
|
@ -76,6 +76,7 @@ npm run test:unit
|
|||
- สร้าง Docker Image แล้ว Push ขึ้น Registry (docker.frappet.com)
|
||||
- ssh ไปที่ (192.168.1.9) เพื่อ pull image ตัวใหม่มาใช้
|
||||
ถ้าจะรันบนเครื่องของเราเอง(local) ให้ติดตั้ง act
|
||||
|
||||
``` bash
|
||||
# Install act (Windows)
|
||||
winget install nektos.act
|
||||
|
|
@ -83,11 +84,12 @@ winget install nektos.act
|
|||
brew install act
|
||||
```
|
||||
|
||||
|
||||
- [ตัวอย่างการใช้งานในบริษัท](https://youtu.be/k1w_cCzCd0o)
|
||||
- [ตัวอย่างการใช้งานกับ .NET](https://youtu.be/k1w_cCzCd0o)
|
||||
|
||||
# CD Argo CD
|
||||
TODO
|
||||
TODO ยังไม่ได้ทำสำหรับโปรเจ็กนี้ แต่ก็ดูวิธีทำจาก
|
||||
[ตัวอย่างการทำ CD ด้วย Argo CD](https://youtu.be/c7sSQLuhht0) ก่อนได้ครับ
|
||||
|
||||
|
||||
## PWA
|
||||
ใน [app.html](./src/app.html) จะเรียกใช้ [manifest.json](./src/static/manifest.json)
|
||||
|
|
|
|||
5
cms/src/lib/ver.json
Normal file
5
cms/src/lib/ver.json
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"version":"Auto gen version",
|
||||
"builddate":"2020-02-02_22:22:22"
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
|
||||
import {getContact} from "$lib/data/info"
|
||||
|
||||
import type { PageServerLoad } from './$types'
|
||||
/*
|
||||
export const load: PageServerLoad = async () => {
|
||||
|
|
@ -8,5 +7,5 @@ export const load: PageServerLoad = async () => {
|
|||
}*/
|
||||
|
||||
export const load = (async () => {
|
||||
return getContact()
|
||||
return getContact()
|
||||
}) satisfies PageServerLoad
|
||||
|
|
|
|||
|
|
@ -1,10 +1,15 @@
|
|||
<script lang="ts">
|
||||
import type { PageData } from './$types'
|
||||
import ver from "$lib/ver.json"
|
||||
export let data: PageData;
|
||||
</script>
|
||||
|
||||
<h1 class="text-4xl">{data.company_name}</h1>
|
||||
|
||||
<div>{data.description}</div>
|
||||
<div>{ver.version}</div>
|
||||
<div>{ver.builddate}</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue