From 35a4abe9a04c7e70f6e8b38b82ca16c79633c8d6 Mon Sep 17 00:00:00 2001 From: Mike <41407352+hunjixin@users.noreply.github.com> Date: Wed, 24 Jan 2024 19:55:43 +0800 Subject: [PATCH] Deployment/test3 (#84) * feat: test deployment --- .github/workflows/build.yml | 14 +++++++++++++- .github/workflows/deployment.yml | 11 +++++++---- .github/workflows/flow.yml | 3 ++- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ada0da0..6d665ca 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,6 +9,18 @@ jobs: runs-on: ubuntu-latest steps: + - name: Print Event + run: | + echo "Event Name: ${{ github.event_name }}" + echo "Repository: ${{ github.repository }}" + echo "SHA: ${{ github.sha }}" + echo "Ref: ${{ github.ref }}" + echo "Action: ${{ github.action }}" + echo "Actor: ${{ github.actor }}" + echo "Workflow Run ID: ${{ github.run_id }}" + echo "Head Repository: ${{ github.head_repository }}" + echo "Base Repository: ${{ github.base_repository }}" + - name: Checkout repo uses: actions/checkout@v3 @@ -19,4 +31,4 @@ jobs: uses: bahmutov/npm-install@v1 - name: Build project - run: npm run build \ No newline at end of file + run: npm run build diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 9e874d1..5b1623c 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -11,7 +11,7 @@ on: required: true jobs: deployment: - if: ${{ startsWith(github.ref, 'refs/heads/deployment/') || github.ref == 'refs/heads/master' }} + if: ${{ startsWith(github.ref, 'refs/heads/deployment/') || github.ref == 'refs/heads/main' }} runs-on: [self-hosted] steps: - name: Checkout repo @@ -19,7 +19,9 @@ jobs: - name: Setup Node uses: actions/setup-node@v3 - + with: + node-version: 18 + - name: Install dependencies uses: bahmutov/npm-install@v1 @@ -39,13 +41,14 @@ jobs: - name: Build and push run: | + ls dist docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }} docker build -t gitdatateam/jiaozifs-ui:${{ steps.version.outputs.version }} . docker push gitdatateam/jiaozifs-ui:${{ steps.version.outputs.version }} - + - name: Deploy uses: WyriHaximus/github-action-helm3@v3 with: - exec: helm install jiaozifs-ui ./chart/ --namespace jiaozifs --set-string api_url=${{ secrets.JIAOZI_API_URL }} --set-string tag=${{ steps.version.outputs.version }} + exec: helm upgrade jiaozifs-ui --install ./chart/ --namespace jiaozifs --set-string api_url=${{ secrets.JIAOZI_API_URL }} --set-string tag=${{ steps.version.outputs.version }} kubeconfig: ${{ secrets.KUBECONTENT }} overrule_existing_kubeconfig: "true" diff --git a/.github/workflows/flow.yml b/.github/workflows/flow.yml index 31e9de1..98eca90 100644 --- a/.github/workflows/flow.yml +++ b/.github/workflows/flow.yml @@ -1,10 +1,11 @@ name: test on: + create: push: branches: - main - - 'deployment/**' + - deployment/** pull_request: branches: - '**'