doc: Fix Storage Class translation mistakes #13965
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy-PullRequest | |
on: | |
issue_comment: | |
types: [created] | |
env: | |
IMAGE_NAME: ks-console:actions-pr-${{ github.event.issue.number }} | |
SERVICE_NAME: ks-console-actions-pr-${{ github.event.issue.number }} | |
jobs: | |
deploy-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: acknowledge deployment request to commenter | |
id: check | |
uses: khan/pull-request-comment-trigger@master | |
with: | |
trigger: "/deploy" | |
reaction: rocket | |
env: | |
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
outputs: | |
triggered: ${{ steps.check.outputs.triggered }} | |
build-and-push: | |
if: needs.deploy-check.outputs.triggered == 'true' | |
runs-on: ubuntu-latest | |
needs: deploy-check | |
strategy: | |
matrix: | |
node-version: [12.18.x] | |
steps: | |
- name: get pull request ref | |
id: get_pull_request_ref | |
uses: octokit/[email protected] | |
with: | |
route: GET /repos/:repository/pulls/:issue_id | |
repository: ${{ github.repository }} | |
issue_id: ${{ github.event.issue.number }} | |
env: | |
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
- uses: actions/checkout@v2 | |
with: | |
repository: ${{ fromJson(steps.get_pull_request_ref.outputs.data).head.repo.full_name }} | |
ref: ${{ fromJson(steps.get_pull_request_ref.outputs.data).head.ref }} | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Build | |
run: | | |
echo "start build" | |
yarn | |
yarn build | |
yarn test | |
docker build . --file Dockerfile --tag kubespheredev/${{ env.IMAGE_NAME }} | |
- name: Docker login | |
uses: azure/docker-login@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Push image | |
run: | | |
echo "push image" | |
docker push kubespheredev/${{ env.IMAGE_NAME }} | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build-and-push | |
steps: | |
- name: get pull request ref | |
id: get_pull_request_ref | |
uses: octokit/[email protected] | |
with: | |
route: GET /repos/:repository/pulls/:issue_id | |
repository: ${{ github.repository }} | |
issue_id: ${{ github.event.issue.number }} | |
env: | |
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
- name: executing remote ssh commands | |
id: deploy_console | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.QING_EIP }} | |
username: root | |
password: ${{ secrets.QING_PASSWORD }} | |
port: 22 | |
script: | | |
kubectl -n kubesphere-system get deploy ks-console -o yaml | kubectl neat | sed "s/kubespheredev\/ks-console:latest/kubespheredev\/${{ env.IMAGE_NAME }}/g" | sed "s/app:\ ks-console/app:\ ${{ env.SERVICE_NAME }}/g" | sed "0,/name:\ ks-console/{s/name:\ ks-console/name:\ ${{ env.SERVICE_NAME }}/}" | kubectl apply -n kubesphere-system -f - | |
kubectl -n kubesphere-system rollout restart deploy ${{ env.SERVICE_NAME }} | |
kubectl -n kubesphere-system expose deploy ${{ env.SERVICE_NAME }} --type=NodePort --port=80 --target-port=8000 | |
kubectl -n kubesphere-system get svc ${{ env.SERVICE_NAME }} | |
- name: set SERVICE_PORT | |
id: set_port | |
run: | | |
sudo apt-get install -y sshpass | |
echo "::set-output name=SERVICE_PORT::$(sshpass -p "${{ secrets.QING_PASSWORD }}" ssh -o StrictHostKeyChecking=no root@${{ secrets.QING_EIP }} "kubectl -n kubesphere-system get svc ${{ env.SERVICE_NAME }} -o json | jq .spec.ports[].nodePort")" | |
- name: Create comment | |
uses: peter-evans/create-or-update-comment@v1 | |
with: | |
issue-number: ${{ github.event.issue.number }} | |
body: | | |
Congratulations! The image of this pr is kubespheredev/${{ env.IMAGE_NAME }}. Deployment succeeded. This is the [preview link](http://${{ secrets.QING_EIP }}:${{ steps.set_port.outputs.SERVICE_PORT }}/) . | |
reactions: heart, hooray, laugh |