Merge pull request #832 from jellyfin/openapi-update-0 #1162
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: SDK Unstable Branch | |
on: | |
schedule: | |
- cron: '0 5 * * *' | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
concurrency: | |
group: unstable-branch | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
if: ${{ github.repository == 'jellyfin/jellyfin-sdk-typescript' }} | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
ref: openapi-unstable | |
fetch-depth: 0 | |
token: ${{ secrets.JF_BOT_TOKEN }} | |
- name: Update unstable branch from master | |
run: | | |
git config user.name jellyfin-bot | |
git config user.email [email protected] | |
git rebase --strategy-option theirs origin/master | |
- name: Set up Node.js | |
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 | |
with: | |
node-version: 20 | |
check-latest: true | |
cache: npm | |
- name: Install Node.js dependencies | |
run: npm ci --no-audit | |
- name: Download unstable OpenAPI schema | |
run: | | |
curl -sL https://api.jellyfin.org/openapi/jellyfin-openapi-unstable.json -o openapi.json | |
npm run fix-schema | |
cp openapi.json $HOME | |
- name: Set UNSTABLE_API_VERSION | |
run: | | |
VERSION=$(jq -r .info.version openapi.json) | |
echo "UNSTABLE_API_VERSION=${VERSION}" >> $GITHUB_ENV | |
- name: Update generated sources | |
run: | | |
cp $HOME/openapi.json . | |
npm run build:generated-client | |
sed -i "s/API_VERSION = '.*'/API_VERSION = '${{ env.UNSTABLE_API_VERSION }}'/" src/versions.ts | |
- name: Commit changes | |
continue-on-error: true | |
run: | | |
[[ -n $(git status --porcelain) ]] && git add --all && git commit --amend -m "Update OpenAPI to unstable" | |
- name: Push changes | |
run: git push --force origin openapi-unstable |