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
|
name: release
|
||||||
run-name: remote-build ${{ github.actor }}
|
run-name: release ${{ github.actor }}
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- 'v[0-9]+.[0-9]+.[0-9]+'
|
- 'v[0-9]+.[0-9]+.[0-9]+'
|
||||||
# tags-ignore:
|
tags-ignore:
|
||||||
# - '2.*'
|
- '2.*'
|
||||||
# Allow run workflow manually from Action tab
|
# Allow run workflow manually from Action tab
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
|
|
@ -15,14 +15,15 @@ on:
|
||||||
env:
|
env:
|
||||||
REGISTRY: docker.frappet.com
|
REGISTRY: docker.frappet.com
|
||||||
IMAGE_NAME: demo/qualifying-exam-cms
|
IMAGE_NAME: demo/qualifying-exam-cms
|
||||||
# IMAGE_TAG: 0.2.1
|
|
||||||
jobs:
|
jobs:
|
||||||
# export GITHUB_REF=refs/tags/v1.2.3
|
# 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
|
||||||
# act workflow_dispatch --input IMAGE_VER=v0.2.1 -W .github/workflows/release.yaml -j release
|
|
||||||
release:
|
release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
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
|
id: gen_ver
|
||||||
run: |
|
run: |
|
||||||
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||||
|
|
@ -33,8 +34,39 @@ jobs:
|
||||||
if [[ $IMAGE_VER == '' ]]; then
|
if [[ $IMAGE_VER == '' ]]; then
|
||||||
IMAGE_VER='beta'
|
IMAGE_VER='beta'
|
||||||
fi
|
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
|
echo '::set-output name=image_ver::'$IMAGE_VER
|
||||||
- name: Test
|
# - name: Test Version
|
||||||
run: |
|
# run: |
|
||||||
echo $GITHUB_REF
|
# echo $GITHUB_REF
|
||||||
echo ${{ steps.gen_ver.outputs.image_ver }}
|
# 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:
|
on:
|
||||||
# push:
|
# push:
|
||||||
# tags:
|
# tags:
|
||||||
# - v1.**
|
# - 'v[0-9]+.[0-9]+.[0-9]+'
|
||||||
# branches:
|
# tags-ignore:
|
||||||
# - 'main'
|
# - '2.*'
|
||||||
# branches:
|
|
||||||
# - 'release-*'
|
|
||||||
|
|
||||||
# Allow run workflow manually from Action tab
|
# Allow run workflow manually from Action tab
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
env:
|
env:
|
||||||
|
|
@ -31,9 +28,10 @@ jobs:
|
||||||
registry: ${{env.REGISTRY}}
|
registry: ${{env.REGISTRY}}
|
||||||
username: ${{secrets.DOCKER_USER}}
|
username: ${{secrets.DOCKER_USER}}
|
||||||
password: ${{secrets.DOCKER_PASS}}
|
password: ${{secrets.DOCKER_PASS}}
|
||||||
- uses: actions/setup-node@v3
|
# Node no need because use 2 state build
|
||||||
with:
|
# - uses: actions/setup-node@v3
|
||||||
node-version: '18'
|
# with:
|
||||||
|
# node-version: '18'
|
||||||
- name: Build and push docker image
|
- name: Build and push docker image
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v3
|
||||||
with:
|
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
|
- [Keycloak](https://www.keycloak.org/) ใช้สำหรับทำระบบ Login
|
||||||
|
|
||||||
## วีดีโอแสดงการทำงานทั้งหมด
|
## วีดีโอแสดงการทำงานทั้งหมด
|
||||||
[](https://youtu.be/WNNDuRjBDd4 "Automate Development")
|
[](https://youtu.be/7CER67WVWec "Automate Development")
|
||||||
|
|
||||||
ในวีดีโอลืมแสดงตัวอย่างการใช้ API
|
ในวีดีโอลืมแสดงตัวอย่างการใช้ API
|
||||||
|
|
||||||
|
|
@ -76,6 +76,7 @@ npm run test:unit
|
||||||
- สร้าง Docker Image แล้ว Push ขึ้น Registry (docker.frappet.com)
|
- สร้าง Docker Image แล้ว Push ขึ้น Registry (docker.frappet.com)
|
||||||
- ssh ไปที่ (192.168.1.9) เพื่อ pull image ตัวใหม่มาใช้
|
- ssh ไปที่ (192.168.1.9) เพื่อ pull image ตัวใหม่มาใช้
|
||||||
ถ้าจะรันบนเครื่องของเราเอง(local) ให้ติดตั้ง act
|
ถ้าจะรันบนเครื่องของเราเอง(local) ให้ติดตั้ง act
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
# Install act (Windows)
|
# Install act (Windows)
|
||||||
winget install nektos.act
|
winget install nektos.act
|
||||||
|
|
@ -83,11 +84,12 @@ winget install nektos.act
|
||||||
brew install act
|
brew install act
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- [ตัวอย่างการใช้งานกับ .NET](https://youtu.be/k1w_cCzCd0o)
|
||||||
- [ตัวอย่างการใช้งานในบริษัท](https://youtu.be/k1w_cCzCd0o)
|
|
||||||
|
|
||||||
# CD Argo CD
|
# CD Argo CD
|
||||||
TODO
|
TODO ยังไม่ได้ทำสำหรับโปรเจ็กนี้ แต่ก็ดูวิธีทำจาก
|
||||||
|
[ตัวอย่างการทำ CD ด้วย Argo CD](https://youtu.be/c7sSQLuhht0) ก่อนได้ครับ
|
||||||
|
|
||||||
|
|
||||||
## PWA
|
## PWA
|
||||||
ใน [app.html](./src/app.html) จะเรียกใช้ [manifest.json](./src/static/manifest.json)
|
ใน [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 {getContact} from "$lib/data/info"
|
||||||
|
|
||||||
import type { PageServerLoad } from './$types'
|
import type { PageServerLoad } from './$types'
|
||||||
/*
|
/*
|
||||||
export const load: PageServerLoad = async () => {
|
export const load: PageServerLoad = async () => {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,15 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { PageData } from './$types'
|
import type { PageData } from './$types'
|
||||||
|
import ver from "$lib/ver.json"
|
||||||
export let data: PageData;
|
export let data: PageData;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<h1 class="text-4xl">{data.company_name}</h1>
|
<h1 class="text-4xl">{data.company_name}</h1>
|
||||||
|
|
||||||
<div>{data.description}</div>
|
<div>{data.description}</div>
|
||||||
|
<div>{ver.version}</div>
|
||||||
|
<div>{ver.builddate}</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue