Skip to content

Commit

Permalink
chore: Refactor main workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
manferlo81 committed Nov 11, 2024
1 parent cd2d193 commit b84a9a3
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 33 deletions.
101 changes: 101 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: CI

on:
push:
branches:
- main
tags:
- v*.*.*

jobs:
job_lint:
name: Lint

runs-on: ubuntu-latest

steps:
- name: Checkout, Setup Node.js v${{ env.NODE_VERSION }} and Install dependencies
uses: manferlo81/action-checkout-node-install@v0
with:
node-version: ${{ env.NODE_VERSION }}
env:
NODE_VERSION: 20.x

- name: Lint
run: npm run lint

job_test_and_build:
strategy:
matrix:
os:
- name: Ubuntu
image: ubuntu-latest
node-version:
- 18.x
- 20.x

name: Test and Build ( ${{ matrix.os.name }}, Node.js v${{ matrix.node-version }} )

runs-on: ${{ matrix.os.image }}
needs: job_lint

steps:
- name: Checkout, Setup Node.js v${{ matrix.node-version }} and Install dependencies
uses: manferlo81/action-checkout-node-install@v0
with:
node-version: ${{ matrix.node-version }}

- name: Test
run: npm test
env:
SKIP_COVERAGE: true

- name: Build
run: npm run build

job_upload_coverage:
name: Upload Coverage

runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref_type == 'branch'
needs: job_test_and_build

steps:
- run: echo "not implemented yet..."

job_create_release:
name: Create GitHub Release

runs-on: ubuntu-latest
if: github.ref_type == 'tag'
needs: job_test_and_build

permissions:
contents: write

steps:
- name: Checkout, Setup Node.js v20.x and Install dependencies
uses: manferlo81/action-checkout-node-install@v0
with:
node-version: 20.x

- name: Build
run: npm run build

- name: Create Tarball
run: npm pack

- name: Create release
uses: manferlo81/action-auto-release@v0
with:
files: map-number-*.tgz

job_publish_to_npm:
name: Publish Package to npm Registry

runs-on: ubuntu-latest
if: github.ref_type == 'tag'
needs: job_test_and_build

steps:
- run: echo "not implemented yet..."
33 changes: 0 additions & 33 deletions .github/workflows/create-release.yml

This file was deleted.

0 comments on commit b84a9a3

Please sign in to comment.