From 9e0928a3274fffbc4546844387171ba48eae75e8 Mon Sep 17 00:00:00 2001 From: LucaZanni Date: Tue, 24 Mar 2026 12:09:50 +0100 Subject: [PATCH] :tada: first commit --- docker-release.yml | 77 ++++++++++++++++++++++++++++++++++++++++++++++ npm-publish.yml | 52 +++++++++++++++++++++++++++++++ quality-gates.yml | 63 +++++++++++++++++++++++++++++++++++++ 3 files changed, 192 insertions(+) create mode 100644 docker-release.yml create mode 100644 npm-publish.yml create mode 100644 quality-gates.yml diff --git a/docker-release.yml b/docker-release.yml new file mode 100644 index 0000000..fcb7647 --- /dev/null +++ b/docker-release.yml @@ -0,0 +1,77 @@ +name: Docker Release + +on: + push: + tags: + - 'v*' + +jobs: + docker-release: + runs-on: catthehacker-latest + steps: + - name: Checkout + uses: https://gitea.com/actions/checkout@v4 + + - name: Setup Node.js + uses: https://gitea.com/actions/setup-node@v4 + with: + node-version: 22.17 + + - name: Cache npm + uses: https://gitea.com/actions/cache@v4 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Configure npm private registry + run: | + echo "@pzeta:registry=https://gitea.pzetatouch.it/api/packages/pzeta_touch/npm/" >> ~/.npmrc + echo "//gitea.pzetatouch.it/api/packages/pzeta_touch/npm/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc + + - name: Install dependencies + run: npm ci + + - name: Type check + run: npm run typecheck + + - name: Lint + run: npm run lint:check + + - name: Format check + run: npm run format:check + + - name: Build + run: npm run build + + - name: Test + run: npm run test + + - name: Login to container registry + uses: https://gitea.com/docker/login-action@v3 + with: + registry: gitea.pzetatouch.it + username: ${{ secrets.G_USER }} + password: ${{ secrets.NPM_TOKEN }} + + - name: Determine image tags + id: tags + run: | + APP_NAME=$(jq -r '.name' package.json) + VERSION=$(jq -r '.version' package.json) + REGISTRY="gitea.pzetatouch.it/pzeta_touch" + echo "version_tag=${REGISTRY}/${APP_NAME}:${VERSION}" >> $GITHUB_OUTPUT + echo "latest_tag=${REGISTRY}/${APP_NAME}:latest" >> $GITHUB_OUTPUT + + - name: Build and push Docker image + uses: https://gitea.com/docker/build-push-action@v6 + with: + push: true + context: . + file: ./Dockerfile + tags: | + ${{ steps.tags.outputs.version_tag }} + ${{ steps.tags.outputs.latest_tag }} + build-args: | + NPM_TOKEN=${{ secrets.NPM_TOKEN }} diff --git a/npm-publish.yml b/npm-publish.yml new file mode 100644 index 0000000..22ec88d --- /dev/null +++ b/npm-publish.yml @@ -0,0 +1,52 @@ +name: Publish npm Package + +on: + push: + tags: + - 'v*' + +jobs: + npm-publish: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: https://gitea.com/actions/checkout@v4 + + - name: Setup Node.js + uses: https://gitea.com/actions/setup-node@v4 + with: + node-version: 22.17 + + - name: Cache npm + uses: https://gitea.com/actions/cache@v4 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Configure npm private registry + run: | + echo "@pzeta:registry=https://gitea.pzetatouch.it/api/packages/pzeta_touch/npm/" >> ~/.npmrc + echo "//gitea.pzetatouch.it/api/packages/pzeta_touch/npm/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc + + - name: Install dependencies + run: npm ci + + - name: Lint + run: npm run lint + + - name: Type check + run: npm run typecheck + + - name: Format check + run: npm run format:check + + - name: Build + run: npm run build + + - name: Test + run: npm run test + + - name: Publish + run: npm publish diff --git a/quality-gates.yml b/quality-gates.yml new file mode 100644 index 0000000..223250a --- /dev/null +++ b/quality-gates.yml @@ -0,0 +1,63 @@ +name: Quality Gates + +on: + push: + branches: + - main + paths-ignore: + - '**.md' + - 'docs/**' + - '.vscode/**' + - '.idea/**' + pull_request: + branches: + - main + +jobs: + quality-gates: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: https://gitea.com/actions/checkout@v4 + + - name: Setup Node.js + uses: https://gitea.com/actions/setup-node@v4 + with: + node-version: 22.17 + + - name: Cache npm + uses: https://gitea.com/actions/cache@v4 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Configure npm private registry + run: | + echo "@pzeta:registry=https://gitea.pzetatouch.it/api/packages/pzeta_touch/npm/" >> ~/.npmrc + echo "//gitea.pzetatouch.it/api/packages/pzeta_touch/npm/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc + + - name: Check outdated packages + run: npm outdated || true + + - name: Install dependencies + run: npm ci + + - name: Security audit + run: npm audit --audit-level=high || true + + - name: Lint + run: npm run lint + + - name: Type check + run: npm run typecheck + + - name: Format check + run: npm run format:check + + - name: Build + run: npm run build + + - name: Test + run: npm run test