From 641c6b20f00ea8277498fc1541109459de3a6001 Mon Sep 17 00:00:00 2001 From: Alex Lanz Date: Fri, 28 Jul 2023 10:37:35 +0200 Subject: [PATCH] optimize CI --- .github/workflows/main.yml | 36 +++++++++++++++++---------- .github/workflows/release-package.yml | 26 ------------------- .github/workflows/test.yml | 18 ++++++++++++++ 3 files changed, 41 insertions(+), 39 deletions(-) delete mode 100644 .github/workflows/release-package.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2f51ceb..ad8758b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,22 +1,32 @@ -name: Test +name: Create Relase & Publish Package on: push: - tags-ignore: - - '**' + tags: + - 'v*' + +env: + NODE_VERSION: 16 jobs: - checks: - runs-on: ubuntu-20.04 + build: + runs-on: ubuntu-22.04 + timeout-minutes: 5 steps: - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - uses: actions/github-script@v6 with: - node-version: 16 - - uses: actions/cache@v3 + script: | + github.rest.repos.createRelease({ + owner: context.repo.owner, + repo: context.repo.repo, + tag_name: '${{ github.ref }}', + name: 'Release ${{ github.ref_name }}' + }) + - uses: aboutbits/github-actions-node/setup-and-install@v1 with: - path: ~/.npm - key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} - - run: npm ci - - run: npm run lint - - run: npm run typecheck + node-version: ${{ env.NODE_VERSION }} + registry-url: 'https://registry.npmjs.org' + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/release-package.yml b/.github/workflows/release-package.yml deleted file mode 100644 index 4d63a19..0000000 --- a/.github/workflows/release-package.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Create Relase & Publish Package -on: - push: - tags: - - 'v*' -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref }} - draft: false - prerelease: false - - uses: actions/setup-node@v3 - with: - node-version: 16 - registry-url: https://registry.npmjs.org - - run: npm ci - - run: npm publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..03e878f --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,18 @@ +name: Test Package + +on: push + +env: + NODE_VERSION: 16 + +jobs: + test: + runs-on: ubuntu-22.04 + timeout-minutes: 15 + steps: + - uses: actions/checkout@v3 + - uses: aboutbits/github-actions-node/setup-and-install@v1 + with: + node-version: ${{ env.NODE_VERSION }} + - run: npm run lint + - run: npm run typecheck