Skip to content

Commit

Permalink
Improve workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
elamperti committed Dec 12, 2023
1 parent f9fcd73 commit 6dc917f
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 23 deletions.
8 changes: 8 additions & 0 deletions .github/release.yml
@@ -0,0 +1,8 @@
changelog:
exclude:
labels:
- ignore-for-release
categories:
- title: Breaking Changes 🛠
labels:
- breaking-change
20 changes: 0 additions & 20 deletions .github/workflow/publish.yml

This file was deleted.

45 changes: 45 additions & 0 deletions .github/workflows/publish.yml
@@ -0,0 +1,45 @@
name: Publish

on:
push:
branches: main

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
environment: production
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
cache: "yarn"
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Test
run: yarn test
- name: Get package version
run: node -p -e '`PACKAGE_VERSION=${require("./package.json").version}`' >> $GITHUB_ENV
- name: Check previous tags
uses: mukunku/tag-exists-action@v1.4.0
id: checkTag
with:
tag: v${{ env.PACKAGE_VERSION }}
- name: Build
if: steps.checkTag.outputs.exists == 'false'
run: yarn build && yarn postbuild
- name: Tag new version
if: steps.checkTag.outputs.exists == 'false'
uses: anothrNick/github-tag-action@1.67.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CUSTOM_TAG: v${{ env.PACKAGE_VERSION }}
- name: Publish
if: steps.checkTag.outputs.exists == 'false'
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
6 changes: 4 additions & 2 deletions .github/workflow/test.yml → .github/workflows/test.yml
Expand Up @@ -14,5 +14,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: "20"
- run: npm ci
- run: npm test
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Test
run: yarn test
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -7,7 +7,8 @@
"scripts": {
"build": "NODE_ENV=production babel src -d dist",
"postbuild": "tsc src/index.js --declaration --allowJs --emitDeclarationOnly --outDir types",
"prepublishOnly": "npm run build && npm test",
"preversion": "yarn test",
"prepublishOnly": "yarn run build && yarn test",
"test": "NODE_ENV=test jest"
},
"author": "Enrico Lamperti",
Expand Down

0 comments on commit 6dc917f

Please sign in to comment.