Skip to content

Publish Release

Publish Release #13

Workflow file for this run

name: Publish Release
on:
workflow_dispatch:
jobs:
publish_release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: npm
registry-url: https://registry.npmjs.org
- run: npm ci
- uses: release-drafter/release-drafter@v6
if: github.ref == 'refs/heads/main'
id: release_drafter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: bump version & publish
if: github.ref == 'refs/heads/main'
run: |
npm version "${{ steps.release_drafter.outputs.tag_name }}" --no-git-tag-version
npm publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: bump preleease version & publish
if: github.ref != 'refs/heads/main'
run: |
latest_ver=$(npm view eslint-config-timetree@latest version)
next_ver=$(npm view eslint-config-timetree@next version)
ver=$(npx semver-compare-cli $latest_ver ge $next_ver && echo $next_ver || echo $latest_ver)
npm version $ver --no-git-tag-version
npm version prerelease --no-git-tag-version
npm publish --tag next
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: push version
if: github.ref == 'refs/heads/main'
run: |
git config --global user.email "[email protected]"
git config --global user.name "github-actions"
git add .
git commit -m ":bookmark: version bump"
git push
- uses: release-drafter/release-drafter@v6
if: github.ref == 'refs/heads/main'
id: release_drafter_publish
with:
publish: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}