Bump @nuxtjs/mdc and @nuxt/content in /docs/.theme #80
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: Publish | |
on: | |
pull_request: | |
types: | |
- labeled | |
branches: | |
- main | |
- 'epic/**' | |
jobs: | |
remove-label: | |
# Remove when not in release branch | |
name: Remove Label | |
if: github.event.label.name == 'Publish' && github.event_name == 'pull_request' && startsWith(github.head_ref, 'release/') == false | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions-ecosystem/action-remove-labels@v1 | |
name: Remove Publish Label | |
with: | |
labels: 'Publish' | |
check-version: | |
# Start publish when in release branch | |
# This job fetches current version from Directory.Build.props and checks if this version already pushed to nuget | |
name: Check Version | |
if: github.event.label.name == 'Publish' && github.event_name == 'pull_request' && startsWith(github.head_ref, 'release/') == true | |
runs-on: ubuntu-latest | |
outputs: | |
# Version number that is parsed from Directory.Build.props | |
version: ${{ steps.parse.outputs.version }} | |
# Flag to indicate a new version should be built or not; | |
# - true means it was already published | |
# - false means pack & push is required | |
action: ${{ steps.check.outputs.action }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Parse Version | |
id: parse | |
run: | | |
# 1. cat outputs content of Directory.Build.props file to stream editor (sed) | |
# 2. first sed removes all lines except with Version info | |
# 3. second sed removes <Version> and </Version> and spaces | |
# 4. result is only version which is set to the $version variable | |
version=$(cat src/Directory.Build.props | sed -n '/<Version>/p' | sed '/[ <>a-zA-Z\/]/ s///g') | |
# value of $version is set as a step output | |
echo "version="$version >> $GITHUB_OUTPUT | |
- name: Check Version in NuGet | |
id: check | |
run: | | |
if wget -q --method=HEAD https://api.nuget.org/v3-flatcontainer/Baked.Recipe.Service/${{ steps.parse.outputs.version }}/Baked.Recipe.Service.nuspec; | |
then | |
echo "action=nothing" >> $GITHUB_OUTPUT | |
else | |
echo "action=pack" >> $GITHUB_OUTPUT | |
fi | |
pack-projects: | |
name: Pack Projects | |
needs: check-version | |
# should only run when this version does not exist in nuget | |
# use contains to check for action value, == operator does not work probably because some space chars in the value | |
if: contains(needs.check-version.outputs.action, 'pack') | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ needs.check-version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 9 | |
- name: Pack | |
run: | | |
dotnet pack -o "packages" -c Release | |
- name: Upload Packages | |
uses: actions/upload-artifact@v4 | |
with: | |
name: packages | |
path: packages/ | |
push-packages: | |
name: Push Packages | |
needs: pack-projects | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Packages | |
uses: actions/download-artifact@v4 | |
with: | |
name: packages | |
- name: Push | |
run: | | |
dotnet nuget push "*.nupkg" \ | |
-s https://api.nuget.org/v3/index.json \ | |
-k ${{ secrets.NUGET_API_KEY }} \ | |
--skip-duplicate \ | |
-t 3600 | |
generate-docs: | |
needs: check-version | |
name: Generate Docs | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ needs.check-version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup NodeJS | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
- name: Disable AppArmour | |
run: echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns | |
- name: Build Docs | |
run: | | |
cd docs/.theme/ | |
npm install | |
npm run generate:production | |
- name: Upload Docs Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: docs | |
path: docs/.theme/.output/public | |
if-no-files-found: error | |
include-hidden-files: true | |
publish-docs: | |
needs: generate-docs | |
name: Publish Docs | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout docs branch | |
uses: actions/checkout@v4 | |
with: | |
ref: baked.mouseless.codes | |
- name: Remove Old Files | |
run: | | |
git rm -rf . | |
git clean -fxd | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: docs | |
- name: Commit & Push | |
run: | | |
git config user.name 'github-actions' | |
git config user.email '[email protected]' | |
git add -A | |
git commit -m 'deploy docs v${{ needs.generate-docs.outputs.version }}' | |
git push -f |