58 lines
1.1 KiB
YAML
58 lines
1.1 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
tags: ["v*"]
|
|
pull_request:
|
|
branches: [master]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
container: node:lts-alpine
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Run linter
|
|
run: npm run lint
|
|
|
|
- name: Run tests
|
|
run: npm run test
|
|
|
|
- name: Build project
|
|
run: npm run build
|
|
|
|
publish:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
container: node:lts-alpine
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Build project
|
|
run: npm run build
|
|
|
|
- name: Set version from git tag
|
|
run: |
|
|
VERSION=${GITHUB_REF#refs/tags/v}
|
|
npm version $VERSION --no-git-tag-version
|
|
|
|
- name: Setup npm for publishing
|
|
run: |
|
|
npm config set //git.3t.network/api/packages/3t.network/npm/:_authToken ${{ secrets.PUBLISH_TOKEN }}
|
|
|
|
- name: Publish to Gitea npm registry
|
|
run: npm publish
|