Skip to content

ci: pushing new workflows #673

ci: pushing new workflows

ci: pushing new workflows #673

Workflow file for this run

name: 'Publish'
on:
workflow_dispatch:
push:
pull_request:
permissions:
contents: write
jobs:
version:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v5
with:
fetch-depth: 100
fetch-tags: true
- name: Use Node.js
uses: actions/setup-node@v6
with:
node-version: 'latest'
- name: Install lint
shell: bash
run: |
npm install -g @commitlint/cli @commitlint/config-conventional
if [ ! -f "commitlint.config.js" ]; then
echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js
fi
- name: Lint Commit Message
if: github.event_name == 'push'
shell: bash
run: commitlint --from=HEAD~2 --verbose
- name: Lint Pull Request
if: github.event_name == 'pull_request'
shell: bash
run: commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
- name: "Get Previous tag"
id: previoustagold
uses: "WyriHaximus/github-action-get-previous-tag@v1"
- name: Conventional Changelog Action
id: changelog
if: github.ref_name == 'main'
uses: TriPSs/conventional-changelog-action@v6
with:
github-token: ${{ github.token }}
git-url: ${{ github.server_url != 'https://github.com' && 'git.yusufali.ca' || 'github.com' }}
tag-prefix: ""
output-file: false
skip-version-file: true
skip-commit: true
skip-ci: false
skip-tag: ${{ github.ref_name != 'main' }}
fallback-version: ${{ steps.previoustagold.outputs.tag }}
codepublish:
runs-on: ubuntu-latest
needs: version
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
fetch-depth: 0
fetch-tags: true
- name: Install git
if: github.ref_name == 'main' && github.server_url != 'https://github.com'
shell: bash
env:
TOKEN: ${{ secrets.GIT_SERVC_TOKEN }}
URL: github.com/${{ github.repository }}.git
run: |
sudo apt-get install -y git
git checkout main
git push https://drgroot:${TOKEN}@${URL} main
git push https://drgroot:${TOKEN}@${URL} --tags
packagepublish:
runs-on: ubuntu-latest
needs: version
steps:
- name: Check out code
uses: actions/checkout@v5
with:
submodules: true
fetch-depth: 100
fetch-tags: true
- name: "Get Previous tag"
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
with:
fallback: 0.0.1
- uses: actions/setup-node@v6
with:
node-version: "current"
registry-url: "https://registry.npmjs.org"
- name: Install dependencies
run: npm ci
- name: Setup Version
env:
TAG: ${{ steps.previoustag.outputs.tag }}
run: |
sed -i "s/\"version\": .*/\"version\": \"$TAG\",/g" package.json
cat package.json
- name: Build package
run: npm run-script build
- name: Publish package
if: github.ref_name == 'main'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --access public