Update gittools/actions action to v3.0.2 #822
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Prepare | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
show-progress: false | |
- uses: gittools/actions/gitversion/[email protected] | |
with: | |
versionSpec: '5.12.x' | |
- uses: gittools/actions/gitversion/[email protected] | |
id: gitversion | |
- if: github.ref_type != 'tag' | |
run: npm version --no-git-tag-version ${{steps.gitversion.outputs.nuGetVersion}}-${{steps.gitversion.outputs.shortSha}} | |
- if: github.ref_type == 'tag' | |
run: npm version --no-git-tag-version ${{steps.gitversion.outputs.nuGetVersion}} | |
# Build | |
- run: npm ci | |
- run: npm run build | |
- run: npm run test | |
- run: npm run docs | |
# Release | |
- name: Create GitHub Release | |
if: github.ref_type == 'tag' | |
uses: softprops/action-gh-release@v2 | |
# Publish (release only) | |
- name: Publish documentation | |
if: github.ref_type == 'tag' | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{github.token}} | |
force_orphan: true | |
publish_dir: docs | |
cname: typescript.typedrest.net | |
- name: Connect to registry (npmjs.com) | |
if: github.ref_type == 'tag' | |
uses: actions/setup-node@v4 | |
with: | |
registry-url: https://registry.npmjs.org | |
- name: Publish packages (npmjs.com) | |
if: github.ref_type == 'tag' | |
run: npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | |
# Publish | |
- name: Connect to registry (GitHub) | |
if: github.event_name == 'push' | |
uses: actions/setup-node@v4 | |
with: | |
registry-url: https://npm.pkg.github.com/ | |
scope: '@typedrest' | |
- name: Publish packages (GitHub) | |
if: github.event_name == 'push' && !startsWith(github.ref_name, 'renovate/') | |
run: | | |
sed -i 's|"typedrest"|"@typedrest/typedrest"|g' package.json | |
npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{github.token}} |