Skip to content

Commit 03e4d6d

Browse files
committed
feat: Add with-restart workflows
1 parent c3154a9 commit 03e4d6d

File tree

3 files changed

+145
-0
lines changed

3 files changed

+145
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Deploy to Dev with Restart
2+
on:
3+
workflow_dispatch:
4+
5+
concurrency:
6+
group: dev-with-restart
7+
cancel-in-progress: false
8+
9+
jobs:
10+
deployToDev:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
15+
with:
16+
fetch-depth: 0
17+
fetch-tags: true
18+
- name: Set up pnpm
19+
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
20+
- name: Set up Node.js
21+
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
22+
with:
23+
cache: 'pnpm'
24+
- name: Disable Husky
25+
run: echo "HUSKY=0" >> $GITHUB_ENV
26+
- name: Install dependencies
27+
run: pnpm install
28+
- name: Run unit tests
29+
run: pnpm test
30+
- name: Run lint
31+
run: pnpm lint
32+
- name: Determine version tag for build
33+
run: |
34+
VERSION_TAG="SHA-${GITHUB_SHA:0:7}"
35+
echo "VITE_STUDIO_VERSION=$VERSION_TAG" >> $GITHUB_ENV
36+
- name: Build dev
37+
run: pnpm build:dev
38+
- name: Deploy to dev
39+
run: |
40+
mkdir deploy
41+
mv web deploy/
42+
cp -R deploy-template/* deploy/
43+
cd deploy
44+
CLI_TARGET_USERNAME=${{ secrets.CLI_TARGET_USERNAME_DEV }} CLI_TARGET_PASSWORD='${{ secrets.HARPERDB_CLI_TARGET_PASSWORD_DEV }}' pnpm harperdb deploy_component project=hdbms target='${{ secrets.CLI_DEPLOY_TARGET_DEV }}' restart=rolling replicated=true
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Deploy to Prod with Restart
2+
on:
3+
workflow_dispatch:
4+
5+
concurrency:
6+
group: prod-with-restart
7+
cancel-in-progress: false
8+
9+
jobs:
10+
deployToProd:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
15+
with:
16+
fetch-depth: 0
17+
fetch-tags: true
18+
- name: Set up pnpm
19+
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
20+
- name: Set up Node.js
21+
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
22+
with:
23+
cache: 'pnpm'
24+
- name: Disable Husky
25+
run: echo "HUSKY=0" >> $GITHUB_ENV
26+
- name: Install dependencies
27+
run: pnpm install
28+
- name: Run unit tests
29+
run: pnpm test
30+
- name: Run lint
31+
run: pnpm lint
32+
- name: Determine version tag for build
33+
run: |
34+
VERSION_TAG=$(git tag --points-at HEAD | grep -E '^v?[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -n1)
35+
if [ -z "$VERSION_TAG" ]; then
36+
VERSION_TAG="v0.0.0+${GITHUB_SHA:0:7}"
37+
fi
38+
echo "VITE_STUDIO_VERSION=$VERSION_TAG" >> $GITHUB_ENV
39+
- name: Build prod
40+
run: pnpm build:prod
41+
- name: Deploy to prod
42+
run: |
43+
mkdir deploy
44+
mv web deploy/
45+
cp -R deploy-template/* deploy/
46+
cd deploy
47+
CLI_TARGET_USERNAME=${{ secrets.CLI_TARGET_USERNAME_PROD }} CLI_TARGET_PASSWORD='${{ secrets.HARPERDB_CLI_TARGET_PASSWORD_PROD }}' pnpm harperdb deploy_component project=hdbms target='${{ secrets.CLI_DEPLOY_TARGET_PROD }}' restart=rolling replicated=true
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Deploy to Stage with Restart
2+
on:
3+
workflow_dispatch:
4+
5+
concurrency:
6+
group: stage-with-restart
7+
cancel-in-progress: false
8+
9+
jobs:
10+
deployToStage:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
17+
with:
18+
fetch-depth: 0
19+
fetch-tags: true
20+
- name: Set up pnpm
21+
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
22+
- name: Set up Node.js
23+
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
24+
with:
25+
cache: 'pnpm'
26+
- name: Disable Husky
27+
run: echo "HUSKY=0" >> $GITHUB_ENV
28+
- name: Install dependencies
29+
run: pnpm install
30+
- name: Run unit tests
31+
run: pnpm test
32+
- name: Run lint
33+
run: pnpm lint
34+
- name: Verify stage can build
35+
run: pnpm build:stage
36+
- name: Determine version tag for build
37+
if: ${{ github.event_name == 'push' }}
38+
run: |
39+
VERSION_TAG=$(git tag --points-at HEAD | grep -E '^v?[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -n1)
40+
if [ -z "$VERSION_TAG" ]; then
41+
VERSION_TAG="v0.0.0+${GITHUB_SHA:0:7}"
42+
fi
43+
echo "VITE_STUDIO_VERSION=$VERSION_TAG" >> $GITHUB_ENV
44+
- name: Build stage for release
45+
if: ${{ github.event_name == 'push' }}
46+
run: pnpm build:stage
47+
- name: Deploy to stage
48+
if: ${{ github.event_name == 'push' }}
49+
run: |
50+
mkdir deploy
51+
mv web deploy/
52+
cp -R deploy-template/* deploy/
53+
cd deploy
54+
CLI_TARGET_USERNAME=${{ secrets.CLI_TARGET_USERNAME }} CLI_TARGET_PASSWORD='${{ secrets.HARPERDB_CLI_TARGET_PASSWORD }}' pnpm harperdb deploy_component project=hdbms target='${{ secrets.CLI_DEPLOY_TARGET }}' restart=rolling replicated=true

0 commit comments

Comments
 (0)