main #883
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
on: | |
push: | |
branches-ignore: | |
- gh-pages | |
tags: | |
- "*" | |
schedule: | |
- cron: 59 14 * * * | |
pull_request: [] | |
name: main | |
jobs: | |
docs: | |
if: github.event_name != 'schedule' || github.repository == 'planetarium/libplanet' | |
name: docs | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@main | |
if: github.event_name != 'pull_request' | |
- uses: actions/checkout@main | |
if: github.event_name == 'pull_request' | |
with: | |
ref: ${{ github.pull_request.head.sha }} | |
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* | |
- uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x | |
- run: dotnet build -p:SkipSonar=true | |
- run: mkdir -p Docs/obj/ | |
- run: Docs/build.ps1 | |
shell: pwsh | |
- uses: actions/upload-artifact@main | |
with: | |
name: docs | |
path: Docs/_site/ | |
- run: Docs/publish.sh | |
env: | |
GHPAGES_SSH_KEY: ${{ secrets.GHPAGES_SSH_KEY }} | |
if: github.event_name != 'pull_request' | |
- id: docs-url | |
run: 'echo ::set-output name=url::"$(cat Docs/obj/url.txt)"' | |
if: github.event_name != 'pull_request' | |
- uses: Sibz/[email protected] | |
with: | |
authToken: ${{ secrets.GITHUB_TOKEN }} | |
context: docs | |
description: Libplanet docs generated by DocFX | |
state: 'success' | |
target_url: ${{ steps.docs-url.outputs.url }} | |
if: github.event_name != 'pull_request' | |
test-npm-cli: | |
name: "test-npm (@planetarium/cli)" | |
strategy: | |
matrix: | |
os: | |
- macos-latest | |
- ubuntu-latest | |
- windows-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@main | |
with: | |
fetch-depth: 0 | |
- id: latest-tag | |
name: Get the latest tag | |
uses: WyriHaximus/github-action-get-previous-tag@v1 | |
with: | |
fallback: 0.27.3 | |
- if: runner.os != 'Windows' | |
run: | | |
set -ev | |
cd Libplanet.Tools/ | |
if [[ "$GITHUB_REF_TYPE" = "tag" ]]; then | |
v="$GITHUB_REF_NAME" | |
else | |
v="$LATEST_VERSION" | |
fi | |
echo "version: '$v'" | |
bin/npm-test.sh "$v" | |
env: | |
LATEST_VERSION: ${{ steps.latest-tag.outputs.tag }} | |
- if: runner.os == 'Windows' | |
run: | | |
$ErrorActionPreference = "Stop" | |
cd Libplanet.Tools\ | |
if ($env:GITHUB_REF_TYPE -eq "tag") { | |
$v = $env:GITHUB_REF_NAME | |
} else { | |
$v = $env:LATEST_VERSION | |
} | |
echo "version: '$v'" | |
powershell ` | |
-ExecutionPolicy Bypass ` | |
-File bin\npm-test.ps1 ` | |
-Version $v | |
env: | |
LATEST_VERSION: ${{ steps.latest-tag.outputs.tag }} | |
test-npm: | |
name: test-npm | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- run: | | |
set -e | |
. .github/bin/constants.sh | |
for npmpkg in "${npm_packages[@]}"; do | |
pushd "$npmpkg" | |
npm install | |
popd | |
done | |
- run: | | |
set -e | |
. .github/bin/constants.sh | |
for npmpkg in "${npm_packages[@]}"; do | |
pushd "$npmpkg" | |
npm test --if-present | |
popd | |
done |