Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #112 from jellyfin/fix/pipeline
Browse files Browse the repository at this point in the history
Fix/pipeline
  • Loading branch information
ThibaultNocchi authored Aug 31, 2021
2 parents 104dcfd + bcb3197 commit 8566f9c
Show file tree
Hide file tree
Showing 3 changed files with 186 additions and 189 deletions.
100 changes: 50 additions & 50 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,61 +15,61 @@ jobs:
- unstable

steps:
- uses: actions/[email protected]
with:
ref: 'master'
- uses: actions/[email protected]
with:
ref: "master"

- name: Setup node environment for NPMJS
uses: actions/[email protected]
with:
node-version: 14
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
cache-dependency-path: |
stable/package-lock.json
unstable/package-lock.json
- name: Setup node environment for NPMJS
uses: actions/[email protected]
with:
node-version: 14
cache: "npm"
registry-url: "https://registry.npmjs.org"
cache-dependency-path: |
stable/package-lock.json
unstable/package-lock.json
- name: Get package version
id: version
run: echo "::set-output name=number::$(echo $(cat package.json | jq '.version') | tr -d '"')"
working-directory: ./${{ matrix.version }}
- name: Get package version
id: version
run: echo "::set-output name=number::$(echo $(cat package.json | jq '.version') | tr -d '"')"
working-directory: ./${{ matrix.version }}

- name: Install dependencies
run: npm ci --no-audit
working-directory: ./${{ matrix.version }}
- name: Install dependencies
run: npm ci --no-audit
working-directory: ./${{ matrix.version }}

- name: Publish to npm
run: npm publish --tag ${{ matrix.version }} --access public
working-directory: ./${{ matrix.version }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish to npm
run: npm publish --tag ${{ matrix.version }} --access public
working-directory: ./${{ matrix.version }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Set as latest in npm
if: ${{ matrix.version == 'stable' }}
run: npm dist-tag add @jellyfin/client-axios@${{ steps.version.outputs.number }} latest
working-directory: ./${{ matrix.version }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Set as latest in npm
if: ${{ matrix.version == 'stable' }}
run: npm dist-tag add @jellyfin/client-axios@${{ steps.version.outputs.number }} latest
working-directory: ./${{ matrix.version }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Setup node environment for GitHub Package Registry
uses: actions/[email protected]
with:
node-version: 14
cache: 'npm'
registry-url: 'https://npm.pkg.github.com'
cache-dependency-path: |
stable/package-lock.json
unstable/package-lock.json
- name: Setup node environment for GitHub Package Registry
uses: actions/[email protected]
with:
node-version: 14
cache: "npm"
registry-url: "https://npm.pkg.github.com"
cache-dependency-path: |
stable/package-lock.json
unstable/package-lock.json
- name: Publish to GitHub Package registry
run: npm publish --tag ${{ matrix.version }} --access public
working-directory: ./${{ matrix.version }}
env:
NODE_AUTH_TOKEN: ${{ secrets.ORG_PAT }}
- name: Publish to GitHub Package registry
run: npm publish --tag ${{ matrix.version }} --access public
working-directory: ./${{ matrix.version }}
env:
NODE_AUTH_TOKEN: ${{ secrets.ORG_PAT }}

- name: Set as latest in GitHub Packages
if: ${{ matrix.version == 'stable' }}
run: npm dist-tag add @jellyfin/client-axios@${{ steps.version.outputs.number }} latest
working-directory: ./${{ matrix.version }}
env:
NODE_AUTH_TOKEN: ${{ secrets.ORG_PAT }}
- name: Set as latest in GitHub Packages
if: ${{ matrix.version == 'stable' }}
run: npm dist-tag add @jellyfin/client-axios@${{ steps.version.outputs.number }} latest
working-directory: ./${{ matrix.version }}
env:
NODE_AUTH_TOKEN: ${{ secrets.ORG_PAT }}
125 changes: 61 additions & 64 deletions .github/workflows/stable-generation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,80 +4,77 @@ on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
ref: 'master'

- name: Download OpenAPI file
run: curl -s https://api.jellyfin.org/openapi/jellyfin-openapi-stable.json > openapi.json

- name: Modify the schema
run: node scripts/modifySchema.mjs openapi.json
- uses: actions/[email protected]

- name: Generate
uses: docker://openapitools/openapi-generator-cli:latest-release
env:
TS_POST_PROCESS_FILE: true
with:
args: >-
generate -i /github/workspace/openapi.json
-g typescript-axios --additional-properties=npmName=@jellyfin/client-axios
--additional-properties=npmRepository=https://www.npmjs.com/package/@jellyfin/client-axios
--additional-properties=supportsES6=true
--additional-properties=useSingleRequestParameter=true
--additional-properties=withSeparateModelsAndApi=true
--additional-properties=modelPackage=models
--additional-properties=apiPackage=api
--enable-post-process-file
-o /github/workspace/stable
- name: Download OpenAPI file
run: curl -s https://api.jellyfin.org/openapi/jellyfin-openapi-stable.json > openapi.json

- name: Check if .ts files were modified
id: diff
run: echo "::set-output name=count::$(git status -s | grep ts | wc -l)"
- name: Modify the schema
run: node scripts/modifySchema.mjs openapi.json

- name: Get OpenApi version
if: ${{ steps.diff.outputs.count }} > 0
id: version
run: echo "::set-output name=number::$(cat openapi.json | jq '.info.version')"
- name: Generate
uses: docker://openapitools/openapi-generator-cli:latest-release
env:
TS_POST_PROCESS_FILE: true
with:
args: >-
generate -i /github/workspace/openapi.json
-g typescript-axios --additional-properties=npmName=@jellyfin/client-axios
--additional-properties=npmRepository=https://www.npmjs.com/package/@jellyfin/client-axios
--additional-properties=supportsES6=true
--additional-properties=useSingleRequestParameter=true
--additional-properties=withSeparateModelsAndApi=true
--additional-properties=modelPackage=models
--additional-properties=apiPackage=api
--enable-post-process-file
-o /github/workspace/stable
- name: Set version in package.json
if: ${{ steps.diff.outputs.count }} > 0
run: |
echo "$(cat stable/package.json | jq '.version = ${{ steps.version.outputs.number }}')" > stable/package.json
echo "$(cat stable/package-lock.json | jq '.version = ${{ steps.version.outputs.number }}')" > stable/package-lock.json
- name: Check if .ts files were modified
id: diff
run: echo "::set-output name=count::$(git status -s | grep ts | wc -l)"

- name: Setup node environment
if: ${{ steps.diff.outputs.count }} > 0
uses: actions/[email protected]
with:
node-version: 14
cache: 'npm'
cache-dependency-path: |
stable/package-lock.json
unstable/package-lock.json
- name: Get OpenApi version
if: ${{ steps.diff.outputs.count }} > 0
id: version
run: echo "::set-output name=number::$(cat openapi.json | jq '.info.version')"

- name: Install dependencies
if: ${{ steps.diff.outputs.count }} > 0
run: npm ci --no-audit
working-directory: ./stable
- name: Set version in package.json
if: ${{ steps.diff.outputs.count }} > 0
run: |
echo "$(cat stable/package.json | jq '.version = ${{ steps.version.outputs.number }}')" > stable/package.json
echo "$(cat stable/package-lock.json | jq '.version = ${{ steps.version.outputs.number }}')" > stable/package-lock.json
- name: Build
if: ${{ steps.diff.outputs.count }} > 0
run: npm run build
working-directory: ./stable
- name: Setup node environment
if: ${{ steps.diff.outputs.count }} > 0
uses: actions/[email protected]
with:
node-version: 14
cache: "npm"
cache-dependency-path: stable/package-lock.json

# "echo" in commit returns true so the build succeeds, even if no changed files
- name: Commit new changes to the repo
if: ${{ steps.diff.outputs.count }} > 0
run: |
git config --global user.email "[email protected]"
git config --global user.name "Jellyfin Packaging Team"
git pull
git add .
git commit -m "Update stable OpenAPI client" || echo
git push
- name: Install dependencies
if: ${{ steps.diff.outputs.count }} > 0
run: npm ci --no-audit
working-directory: ./stable

- name: Build
if: ${{ steps.diff.outputs.count }} > 0
run: npm run build
working-directory: ./stable

# "echo" in commit returns true so the build succeeds, even if no changed files
- name: Commit new changes to the repo
if: ${{ steps.diff.outputs.count }} > 0 && github.event_name != 'pull_request'
run: |
git config --global user.email "[email protected]"
git config --global user.name "Jellyfin Packaging Team"
git pull
git add .
git commit -m "Update stable OpenAPI client" || echo
git push
Loading

0 comments on commit 8566f9c

Please sign in to comment.