Skip to content

Merge branch 'main' of github.com:zeon256/mdt2json #36

Merge branch 'main' of github.com:zeon256/mdt2json

Merge branch 'main' of github.com:zeon256/mdt2json #36

Workflow file for this run

name: CI/CD
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
EXPIRY_DAYS: 1
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js environment
uses: actions/setup-node@v3
with:
node-version: latest
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
- name: Build all
run: npm run build:all
- name: Run Library tests
run: npm run test:lib
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: release-artifact
path: |
dist
package.lock.json
package.json
- name: Publish Library to NPM (dry run)
# Only run if the commit is tagged with v<version>
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN && npm publish --dry-run
# job depends on the build job
release:
runs-on: ubuntu-latest
needs: build
# make sure it only run on main and ensure that it does not contain [skip ci] in the commit message
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, '[skip ci]')
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm install -g semantic-release @semantic-release/git @semantic-release/changelog @semantic-release/exec @semantic-release/npm
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: release-artifact
path: .
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_CI }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release