Skip to content

Update ci.yaml

Update ci.yaml #39

Workflow file for this run

name: 持续集成
on:
push:
branches:
- 'feature/**'
jobs:
Auto-PR:
name: Auto Create PR
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: 获取代码
uses: actions/checkout@master
- name: Check if it's the first commit
id: is_first_commit
run: |
if [[ $(git rev-parse --abbrev-ref HEAD) != "main" ]]; then
git fetch origin main
COMMIT_COUNT=$(git rev-list --count HEAD..origin/main)
echo "is_first_commit=$(test $COMMIT_COUNT -eq 0 && echo true || echo false)" >> $GITHUB_ENV
else
echo "is_first_commit=false" >> $GITHUB_ENV
fi
- name: 创建PR
if: env.is_first_commit == 'true'
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.TOKEN_GITHUB }}
delete-branch: true
base: main
branch: ${{ github.ref }}
Unit-Test:
needs: Auto-PR
name: Unit-Test
runs-on: ubuntu-latest
if: env.is_first_commit == 'false'

Check failure on line 38 in .github/workflows/ci.yaml

View workflow run for this annotation

GitHub Actions / 持续集成

Invalid workflow file

The workflow is not valid. .github/workflows/ci.yaml (Line: 38, Col: 9): Unrecognized named-value: 'env'. Located at position 1 within expression: env.is_first_commit == 'false' .github/workflows/ci.yaml (Line: 50, Col: 9): Unrecognized named-value: 'env'. Located at position 1 within expression: env.is_first_commit == 'false'
steps:
- name: 开始扫描
run: |
echo Unit-Test
- name: 完成扫描
run: |
echo upload evidence
Sonar-Qube-Scan:
needs: Auto-PR
name: Sonar-Qube-Scan
runs-on: ubuntu-latest
if: env.is_first_commit == 'false'
steps:
- name: 开始扫描
run: |
echo SonarQube Scan
- name: 完成扫描
run: |
echo upload evidence
Build-Package:
needs: Auto-PR
name: Build-Package
runs-on: ubuntu-latest
if: env.is_first_commit == 'false'
steps:
- name: 开始构建包
run: |
echo mvn clean package
- name: 开始上传制品
run: |
echo upload package
Build-Image:
needs: Build-Package
name: Build-Image
runs-on: ubuntu-latest
if: env.is_first_commit == 'false'
steps:
- name: 开始构建镜像
run: |
echo docker build .
- name: 开始上传制品
run: |
echo upload image
Build-Chart:
needs: Build-Image
name: Build-Chart
runs-on: ubuntu-latest
if: env.is_first_commit == 'false'
steps:
- name: 开始构建Chart
run: |
echo helm build .
- name: 开始上传制品
run: |
echo upload chart
Deploy-Validate:
needs: [Build-Package,Build-Image,Build-Chart]
name: Deploy-Validate
runs-on: ubuntu-latest
if: env.is_first_commit == 'false'
steps:
- name: 开始部署
run: |
echo helm build .
- name: 部署完成
run: |
echo upload chart
SAST-SCAN:
needs: Deploy-Validate
name: SAST-Scan
runs-on: ubuntu-latest
if: env.is_first_commit == 'false'
steps:
- name: SAST-Scan Start
run: |
echo SAST-SCAN
- name: SAST-Scan Completed
run: |
echo SAST-SCAN
DAST-SCAN:
needs: Deploy-Validate
name: DAST-Scan
runs-on: ubuntu-latest
if: env.is_first_commit == 'false'
steps:
- name: DAST-Scan Start
run: |
echo DAST-SCAN
- name: DAST-Scan Completed
run: |
echo DAST-SCAN
CONT-SCAN:
needs: Deploy-Validate
name: CONT-Scan
runs-on: ubuntu-latest
if: env.is_first_commit == 'false'
steps:
- name: CONT-Scan Start
run: |
echo CONT-SCAN
- name: CONT-Scan Completed
run: |
echo CONT-SCAN
FOSS-SCAN:
needs: Deploy-Validate
name: FOSS-Scan
runs-on: ubuntu-latest
if: env.is_first_commit == 'false'
steps:
- name: FOSS-Scan Start
run: |
echo FOSS-SCAN
- name: FOSS-Scan Completed
run: |
echo FOSS-SCAN
Regression-Test:
needs: Deploy-Validate
name: Regression-Test
runs-on: ubuntu-latest
if: env.is_first_commit == 'false'
steps:
- name: Regression-Test Start
run: |
echo Regression-Test
- name: Regression-Test Completed
run: |
echo Regression-Test
Performance-Test:
needs: Deploy-Validate
name: Performance-Test
runs-on: ubuntu-latest
if: env.is_first_commit == 'false'
steps:
- name: Performance-Test Start
run: |
echo Performance-Test
- name: Performance-Test Completed
run: |
echo Performance-Test
Notification-Email:
needs: [Regression-Test,Performance-Test,FOSS-SCAN,CONT-SCAN,DAST-SCAN,SAST-SCAN]
name: Notification-Email
runs-on: ubuntu-latest
if: env.is_first_commit == 'false'
steps:
- name: Notification-Email
run: |
echo Send an email.