diff --git a/.github/workflows/auto-tag.yml b/.github/workflows/auto-tag.yml index f8dfa45..855eaa7 100644 --- a/.github/workflows/auto-tag.yml +++ b/.github/workflows/auto-tag.yml @@ -1,6 +1,6 @@ # Compares the version in package.json to tags on the repo. If the tag doesn't exist, a new tag is created, which # then triggers the normal "on tag" release automation in the build job -name: Auto Tag +name: Tag, Release, and Publish to NPM on: push: @@ -11,7 +11,7 @@ concurrency: group: main-release-check jobs: - tag-and-changelog: + tag-release-publish: name: Changelog and Tag runs-on: ubuntu-latest steps: @@ -25,13 +25,21 @@ jobs: token: ${{ secrets.PACKAGE_ADMIN_PAT }} fetch-depth: 0 + - name: Setup Node 18.x + uses: actions/setup-node@v3 + with: + node-version: "18" + - name: Configure commit signing for ChiaAutomation uses: Chia-Network/actions/commit-sign/gpg@main with: gpg_private_key: ${{ secrets.CHIA_AUTOMATION_PRIVATE_GPG_KEY }} passphrase: ${{ secrets.CHIA_AUTOMATION_PRIVATE_GPG_PASSPHRASE }} - - name: Check for current version tag. Create if it doesn't exist + - name: Create tag, create release, publish to npm + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} run: | version=$(cat $GITHUB_WORKSPACE/package.json | jq -r '.version') echo "Version is: $version" @@ -48,4 +56,11 @@ jobs: git tag $version -m "Release $version $changes" git push origin $version git push origin main + gh release create --verify-tag --notes-from-tag $version + echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc + npm publish --access public fi + + - name: Cleanup + if: always() + run: rm .npmrc || true diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml deleted file mode 100644 index f4c6415..0000000 --- a/.github/workflows/publish-npm.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Publish to NPM - -on: - release: - types: [published] - -concurrency: - group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }} - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - name: Checkout Code - uses: actions/checkout@v3 - - - name: Setup Node 18.x - uses: actions/setup-node@v3 - with: - node-version: "18" - - - name: Publish to NPM - env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - run: | - echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc - npm publish --access public - - - name: Cleanup - if: always() - run: rm .npmrc || true diff --git a/index.js b/index.js index e1d8c65..6a97609 100644 --- a/index.js +++ b/index.js @@ -42,7 +42,7 @@ class Logger { addColors(customLevels.colors); const chiaRoot = getChiaRoot(); - const logDir = `${chiaRoot}/core-registry/logs/${projectName}`; + const logDir = `${chiaRoot}/core-registry/logs`; if (!fs.existsSync(logDir)) { fs.mkdirSync(logDir, { recursive: true }); @@ -71,16 +71,16 @@ class Logger { ), transports: [ new transports.File({ - filename: `${logDir}/error.log`, + filename: `${logDir}/${projectName}-error.log`, level: "error", format: sharedFileFormat, }), new transports.File({ - filename: `${logDir}/combined.log`, + filename: `${logDir}/${projectName}-combined.log`, format: sharedFileFormat, }), new DailyRotateFile({ - filename: `${logDir}/application-%DATE%.log`, + filename: `${logDir}/${projectName}-application-%DATE%.log`, datePattern: "YYYY-MM-DD", zippedArchive: true, maxSize: "20m", diff --git a/package.json b/package.json index a195e07..1e046d0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@chia-carbon/core-registry-logger", - "version": "1.0.1", + "version": "1.0.2", "description": "Custom logger for core registry projects", "main": "index.js", "scripts": {