From 1fb18916f8a4897530bdad92e9aeff03977cddba Mon Sep 17 00:00:00 2001 From: Carmine Porricelli Date: Tue, 16 Jul 2024 10:08:04 +0200 Subject: [PATCH] Added github ci and release workflows --- .github/workflows/ci.yml | 58 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 35 +++++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d2af39c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,58 @@ +name: CI +on: + push: + branches: main + pull_request: + +jobs: + formatting: + name: Check formatting + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4 + with: + node-version-file: ./package.json + - uses: pnpm/action-setup@v4 + with: + run_install: true + - run: pnpm format:check + + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4 + with: + node-version-file: ./package.json + - uses: pnpm/action-setup@v4 + with: + run_install: true + - run: pnpm lint + + check: + name: Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4 + with: + node-version-file: ./package.json + - uses: pnpm/action-setup@v4 + with: + run_install: true + - run: pnpm check + + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4 + with: + node-version-file: ./package.json + - uses: pnpm/action-setup@v4 + with: + run_install: true + - run: pnpm build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..e2fef46 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,35 @@ +name: Publish package to GitHub Packages +on: + push: + branches: + - main + paths-ignore: + - "CODEOWNERS" + - "**.md" + - ".**" + +jobs: + release: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + fetch-depth: 0 + + - uses: actions/setup-node@v4 + with: + node-version: "20.x" + registry-url: "https://npm.pkg.github.com" + scope: "@pagopa" + + - uses: pnpm/action-setup@v2 + + - run: pnpm i --frozen-lockfile + - run: pnpm build + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.BOT_TOKEN }}