Skip to content

fix

fix #58

Workflow file for this run

name: Build
on:
push:
branches: [main]
pull_request:
branches: [main]
release:
types: [published]
jobs:
build:
name: Build - Spec
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# Needed fo GitVersion
- name: Setup - .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
- name: Setup - GitVersion
uses: gittools/actions/gitversion/setup@v3.0
with:
versionSpec: 5.12.0
- name: Setup - Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Generate - Version
id: gitversion
uses: gittools/actions/gitversion/execute@v3.0
with:
useConfigFile: true
configFilePath: GitVersion.yml
- name: Replace - Version
run: sed -i 's/0.0.0/${{ steps.gitversion.outputs.majorMinorPatch }}-${{ steps.gitversion.outputs.preReleaseLabel }}${{ steps.gitversion.outputs.preReleaseNumber }}/g' openapi/openapi.yml
- name: Bun - Install
run: bun install --frozen-lockfile
- name: Bun - Lint
run: bun run lint
- name: Bun - Build
run: bun run build
- name: Upload - Spec
uses: actions/upload-artifact@v4
with:
name: spec
path: dist
retention-days: 90
if-no-files-found: error
- name: Release - Upload assets
uses: softprops/action-gh-release@v2
if: ${{ github.event_name == 'release' }}
with:
files: |
dist/*.html
dist/*.yaml
dist/*.yml
dist/*.json
pages:
name: Pages - Update branch
runs-on: ubuntu-latest
needs: build
if: ${{ github.ref_name == github.event.repository.default_branch || github.event_name == 'release' }}
permissions:
contents: write
actions: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: gh-pages
- name: Clean - /preview
if: ${{ github.ref_name == github.event.repository.default_branch }}
run: |
rm -rf /preview
- name: Clean - /
if: ${{ github.event_name == 'release' }}
run: |
rm -f ./*.{html,yaml,yml,json}
- name: Download - spec
uses: actions/download-artifact@v4
with:
name: spec
- name: Setup - Update branch Git User
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
# Move all *.yaml, *.yml, *.json, and *.html files to /preview, mkdir if needed
# git add the entire /preview folder
# for every file added, do a git commit of "Update - <file-name>.json"
- name: Commit - /preview
if: ${{ github.ref_name == github.event.repository.default_branch }}
run: |
# Create the /preview directory if it doesn't exist
mkdir -p preview
# Move all specified files to the /preview directory
mv *.yaml *.yml *.json *.html preview/ 2>/dev/null || true
# Add the entire /preview folder to Git
git add preview
# Commit changes if there are any
git diff --quiet && git diff --staged --quiet || git commit -m "Update - /preview"
# git add all *.yaml, *.yml, *.json, and *.html files in the root dir
# for every file added, do a git commit of "Update - <file-name>.json"
- name: Commit - /
if: ${{ github.event_name == 'release' }}
run: |
# Add all specified files in the root directory
git add *.yaml *.yml *.json *.html
# Commit changes if there are any
git diff --quiet && git diff --staged --quiet || git commit -m "Update - /"
- name: Push
run: git push origin gh-pages
- name: Trigger - Deploy
run: gh workflow run deploy-pages.yml --ref gh-pages
env:
GH_TOKEN: ${{ github.token }}