From ce130cb4c403f22c6a2ac57f5b7baa7c1b8571ca Mon Sep 17 00:00:00 2001 From: Kevin Rocker Date: Sat, 14 Sep 2024 23:58:33 +0100 Subject: [PATCH] Initial Tag/Release Workflow --- .github/workflows/pull_request.yml | 6 +++- .github/workflows/release.yml | 55 +++++++++++++----------------- .vscode/settings.json | 4 +-- package-lock.json | 4 +-- package.json | 4 +-- 5 files changed, 34 insertions(+), 39 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 39eb25a..39ea1b5 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -1,6 +1,10 @@ name: CI -on: [pull_request] +on: + pull_request: + push: + branches: + - main jobs: Test: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ee930e6..16601c1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,37 +1,30 @@ -name: Release +name: Deploy to NPM on: - push: - branches: - - main + release: + types: [created] jobs: - Test: + deploy: runs-on: ubuntu-latest - strategy: - matrix: - node-version: ['18.x', '20.x', '22.x'] + steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - name: Use Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - - run: npm ci - - run: npm test - - run: npm run build - # Release: - # runs-on: ubuntu-latest - # needs: Test - # steps: - # - uses: actions/checkout@v4 - # - name: Use Node.js - # uses: actions/setup-node@v4 - # with: - # node-version: '22.x' - # cache: 'npm' - # - run: npm ci - # - run: npm run release \ No newline at end of file + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '22.x' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Update package version + run: npm version ${{ github.event.release.tag_name }} --no-git-tag-version + + - name: Publish to NPM + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index a2eb755..23fd35f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,3 @@ { - "editor.formatOnSave": true, - "editor.tabSize": 2, - "files.autoSave": "onFocusChange", + "editor.formatOnSave": true } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 8e3ce99..84507e9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "epochal", - "version": "1.1.0", + "version": "1.2.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "epochal", - "version": "1.1.0", + "version": "1.2.0", "license": "MIT", "dependencies": { "date-fns": "^3.6.0" diff --git a/package.json b/package.json index c6b42ae..f03e31c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "epochal", - "version": "1.1.0", + "version": "1.2.0", "description": "Convert ambiguous historical dates into precise start and end dates with ease ", "main": "build/index.js", "scripts": { @@ -36,4 +36,4 @@ "dependencies": { "date-fns": "^3.6.0" } -} \ No newline at end of file +}