Update to latest docfx version, run with dotnet instead of mono (#240) #406
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: Releasables | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
jobs: | |
pack-netstandard: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8' | |
- name: Build nupkg | |
run: dotnet pack src --output nupkg | |
- name: Archive nupkg | |
uses: actions/upload-artifact@v4 | |
with: | |
name: nupkg | |
path: nupkg/* | |
docs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache Library | |
uses: actions/cache@v4 | |
with: | |
path: ResponsibleUnity/Library | |
key: 2019-Library-${{ hashFiles('com.beatwaves.responsible/**', 'ResponsibleUnity/**', 'src/Responsible.Tests/**') }} | |
restore-keys: | | |
2019-Library- | |
- name: Generate docs | |
uses: game-ci/unity-builder@v4 | |
env: | |
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
with: | |
projectPath: ResponsibleUnity | |
customImage: thesbergen/unityci-docfx:2022-dotnet | |
targetPlatform: StandaloneLinux64 | |
buildMethod: Responsible.EditorSetup.ContinuousIntegration.BuildDocumentation | |
customParameters: -disable-assembly-updater | |
- name: Archive docs | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Docs | |
path: docfx/docs_site | |
- name: Deploy docs | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
branch: gh-pages | |
folder: docfx/docs_site/ResponsibleDocs | |
dry-run: ${{ github.ref != 'refs/heads/main' }} | |
version-info: | |
runs-on: ubuntu-latest | |
outputs: | |
old-version: ${{ steps.latest-release-version.outputs.result }} | |
new-version: ${{ steps.unity-version.outputs.prop }} | |
changelog-body: ${{ steps.changelog.outputs.changes }} | |
tag-name: ${{ steps.create-tag-name.outputs.tag }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get latest release version | |
id: latest-release-version | |
uses: actions/github-script@v7 | |
with: | |
result-encoding: string | |
script: | | |
const [owner, repo] = process.env['GITHUB_REPOSITORY'].split('/', 2); | |
const { data } = await github.rest.repos.getLatestRelease({ owner, repo }); | |
return data.tag_name.substr(1); | |
- name: Read current Unity package version | |
id: unity-version | |
uses: notiz-dev/github-action-json-property@release | |
with: | |
path: com.beatwaves.responsible/package.json | |
prop_path: 'version' | |
- name: Read current NuGet package version | |
id: nuget-version | |
run: | | |
version=$(sed -n 's:.*<Version>\(.*\)</Version>.*:\1:p' com.beatwaves.responsible/Runtime/Responsible.csproj) | |
echo "version=${version}" >> "$GITHUB_OUTPUT" | |
- name: Get latest changelog entry | |
id: changelog | |
uses: mindsers/changelog-reader-action@v2 | |
- name: Output version status | |
env: | |
CHANGELOG: ${{ steps.changelog.outputs.changes }} | |
run: | | |
echo "Previous release version: ${{ steps.latest-release-version.outputs.result }}" | |
echo "Current version from Unity package.json: ${{ steps.unity-version.outputs.prop }}" | |
echo "Current version from NuGet package: ${{ steps.nuget-version.outputs.version }}" | |
echo "Current version from CHANGELOG.md: ${{ steps.changelog.outputs.version }}" | |
echo "Changes in changelog:" | |
echo $CHANGELOG | |
- name: Check that Unity version is up to date with changelog | |
run: test ${{ steps.unity-version.outputs.prop }} = ${{ steps.changelog.outputs.version }} | |
- name: Check that NuGet version is up to date with changelog | |
run: test ${{ steps.nuget-version.outputs.version }} = ${{ steps.changelog.outputs.version }} | |
- name: Create tag name | |
id: create-tag-name | |
run: echo "tag=v${{ steps.nuget-version.outputs.version }}" >> "$GITHUB_OUTPUT" | |
release: | |
runs-on: ubuntu-latest | |
name: Create Release | |
needs: [ version-info, docs, pack-netstandard ] | |
if: | | |
github.ref == 'refs/heads/main' && | |
needs.version-info.outputs.new-version != needs.version-info.outputs.old-version | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8' | |
- name: Download Docs | |
uses: actions/download-artifact@v4 | |
with: | |
name: Docs | |
- name: Download NuGet package | |
uses: actions/download-artifact@v4 | |
with: | |
name: nupkg | |
- name: Zip source code and docs | |
run: | | |
zip -r com.beatwaves.responsible.zip com.beatwaves.responsible | |
zip -r ResponsibleDocs.zip ResponsibleDocs | |
- uses: softprops/action-gh-release@v2 | |
with: | |
fail_on_unmatched_files: true | |
body: ${{ needs.version-info.outputs.changelog-body }} | |
tag_name: ${{ needs.version-info.outputs.tag-name }} | |
files: | | |
ResponsibleDocs.zip | |
com.beatwaves.responsible.zip | |
Beatwaves.Responsible.*.nupkg | |
- name: Publish NuGet package | |
run: dotnet nuget push Beatwaves.Responsible.*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_PUBLISH_KEY }} |