diff --git a/.github/workflows/deploy-test.yaml b/.github/workflows/deploy-test.yaml new file mode 100644 index 00000000..15bcb7c7 --- /dev/null +++ b/.github/workflows/deploy-test.yaml @@ -0,0 +1,46 @@ +name: deploy +on: + push: + branches: + - main + paths-ignore: + - .gitignore + - README.md + - '.github/ISSUE_TEMPLATE/**' +jobs: + run: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@master + - name: Docker Login + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Test IP Address + run: | + wget -qO- https://ipecho.net/plain ; echo + - name: Set Kubectl + uses: Azure/k8s-set-context@v1 + with: + kubeconfig: ${{ secrets.KUBE_CONFIG }} + - name: Test Kubectl + run: | + kubectl get nodes + kubectl get svc -n zhishuyun-test + - name: Generate Build Number + uses: einaregilsson/build-number@v2 + with: + token: ${{ secrets.github_token }} + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' + - name: Get Build Number + run: | + echo $BUILD_NUMBER + - name: Build Push Deploy + run: | + docker-compose build + docker-compose push + sh ./deploy/test/deploy.sh diff --git a/Dockerfile b/Dockerfile index e33911cf..08ffbf68 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,7 @@ WORKDIR /app COPY package.json yarn.lock ./ RUN yarn COPY . . +RUN yarn run init:https RUN yarn build # production stage diff --git a/deploy.sh b/deploy/test/deploy.sh similarity index 100% rename from deploy.sh rename to deploy/test/deploy.sh diff --git a/package.json b/package.json index bad6d935..75e01d4e 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,10 @@ "build:production": "npm run build --env=production", "serve": "vite preview", "lint": "npx eslint src --fix --ext .ts,.tsx,.vue,.js,.jsx", - "prettier": "npx prettier --write ." + "prettier": "npx prettier --write .", + "init:https": "npm run init:ca && npm run init:cert", + "init:ca": "npx mkcert create-ca --validity 36500 --key certs/auth.local.zhishuyun.com.ca.key --cert certs/auth.local.zhishuyun.com.ca.crt", + "init:cert": "npx mkcert create-cert --ca-key certs/auth.local.zhishuyun.com.ca.key --ca-cert certs/auth.local.zhishuyun.com.ca.crt --validity 36500 --key certs/auth.local.zhishuyun.com.cert.key --cert certs/auth.local.zhishuyun.com.cert.crt --domains auth.local.zhishuyun.com" }, "dependencies": { "@types/uuid": "^8.3.4", @@ -54,6 +57,7 @@ "eslint-plugin-promise": "^6.0.0", "eslint-plugin-vue": "^8.5.0", "husky": "^7.0.2", + "mkcert": "^1.4.0", "postcss": "^8.3.6", "prettier": "^2.6.2", "rollup-plugin-string": "^3.0.0",