This commit is contained in:
2023-08-24 15:19:34 +08:00
parent 5e8daaae95
commit 177afd6374

View File

@ -5,6 +5,9 @@ on:
branches: branches:
- "main" - "main"
env:
ATTRIBUTES: { "git_url": "https://git.treesir.pub/demoTest/simple-web-service", "git_branch": "main", "git_auth": false, "registry_auth": true, "registry_username": "yangzun", "registry_password": "${{ secrets.CI_REGISTRY_PASSWORD }}", "image": "yangzun/simple-web-service:${{ github.sha }}", "namespace": "default", "name": "simple-web-service", "ports": [8080] }
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -24,8 +27,24 @@ jobs:
- name: Deploy - name: Deploy
run: | run: |
# Setup CLI config # Setup CLI config
./walrus config setup --server ${{ secrets.CI_WALRUS_SERVER }} --project web --environment dev --token ${{ secrets.CI_WALRUS_TOKEN }} ./walrus config setup \
--server ${{ secrets.CI_WALRUS_SERVER }} \
--project web \
--environment dev \
--token ${{ secrets.CI_WALRUS_TOKEN }}
# Build and deploy from source code # Build and deploy from source code
./walrus service create --name simple-web-service --template '{"name":"deploy-source-code", "version":"v0.0.1"}' --attributes '{ "git_url": "https://git.treesir.pub/demoTest/simple-web-service", "git_branch": "main", "git_auth": false, "registry_auth": true, "registry_username": "yangzun", "registry_password": "${{ secrets.CI_REGISTRY_PASSWORD }}", "image": "yangzun/simple-web-service:${{ github.sha }}", "namespace": "default", "name": "simple-web-service", "ports": [8080] }' -d ./walrus service create \
--name simple-web-service \
--template '{"name":"deploy-source-code", "version":"v0.0.1"}' \
--attributes ${ATTRIBUTES} \
-d
# Upgrade deploy
if [ ! $(echo $?) -eq '0' ];then
./walrus service upgrade simple-web-service \
--template '{"name":"deploy-source-code", "version":"v0.0.1"}' \
--attributes ${ATTRIBUTES}
fi