From 60c1e61f738792bb23dc2d6de950318845489564 Mon Sep 17 00:00:00 2001 From: Cheney Date: Wed, 16 Apr 2025 15:34:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=20CICD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/ci.yaml | 34 ++++++++++++++++++++++++++++++++++ .gitea/workflows/deploy.yaml | 0 2 files changed, 34 insertions(+) create mode 100644 .gitea/workflows/ci.yaml create mode 100644 .gitea/workflows/deploy.yaml diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml new file mode 100644 index 0000000..151c2cb --- /dev/null +++ b/.gitea/workflows/ci.yaml @@ -0,0 +1,34 @@ +name: TDevOPsCICD + +on: [push] + +jobs: + lint-and-test: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.x, 20.x] + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm ci + - run: npm run lint + - run: npm test + env: + NODE_ENV: test + + build-image: + runs-on: ubuntu-latest + needs: lint-and-test + steps: + - uses: actions/checkout@v4 + - name: Build Docker Image + run: | + docker build -t my-registry.com/my-node-app:${{ github.sha }} . + docker push my-registry.com/my-node-app:${{ github.sha }} + env: + DOCKER_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} \ No newline at end of file diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml new file mode 100644 index 0000000..e69de29