Skip to content

Merge pull request #214 from summer-ospp/ospp-jinshanshan-patch-2 #132

Merge pull request #214 from summer-ospp/ospp-jinshanshan-patch-2

Merge pull request #214 from summer-ospp/ospp-jinshanshan-patch-2 #132

Workflow file for this run

name: deploy
on:
push:
branches: [ 2024 ]
pull_request:
branches: [ 2024 ]
env:
REGISTRY: hub.oepkgs.net
IMAGE_NAME: summer-ospp/help
jobs:
deploy:
name: deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.9'
- run: pip install -r requirements.txt
- run: mkdocs build --strict --verbose
- name: Setup Docker buildx
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.OEPKGS_USERNAME }}
password: ${{ secrets.OEPKGS_PASSWORD }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: ${{ github.sha }}
- name: Build and push Docker image
id: push-meta
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Extract Docker metadata
id: metb
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: ${{ github.GITHUB_REF }}
- name: Build and push Docker image
id: push-metb
uses: docker/build-push-action@v4.0.0
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.metb.outputs.tags }}
labels: ${{ steps.metb.outputs.labels }}
- name: Deploy in Huawei CCE
if: github.event_name != 'pull_request'
uses: summer-ospp/ssh-action@v0.1.4
env:
SHA: ${{ github.sha }}
IMAGE: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT }}
script_stop: true
envs: SHA,IMAGE
script: |
SHA=$SHA;IMAGE=$IMAGE;kubectl set image deployment/summer2024-help-en summer2024-help-en=$IMAGE:$SHA -n summer2024;
sleep 20
kubectl get pod -n summer2024