diff options
| author | Joshua M. Boniface <joshua@boniface.me> | 2024-03-25 10:32:52 -0400 |
|---|---|---|
| committer | Joshua M. Boniface <joshua@boniface.me> | 2024-03-25 10:33:37 -0400 |
| commit | b77a9e98c284a09b296f8fff0691199d39dd389b (patch) | |
| tree | 8bdf00cc69e599433958eeadef0896d1cdf5f197 | |
| parent | 5437936bb91efa8a38bfcb15a39e29f08148683f (diff) | |
Add openapi.json upload to new repo server
| -rw-r--r-- | .github/workflows/ci-openapi.yml | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/.github/workflows/ci-openapi.yml b/.github/workflows/ci-openapi.yml index b5ccafb86..ede94b54c 100644 --- a/.github/workflows/ci-openapi.yml +++ b/.github/workflows/ci-openapi.yml @@ -137,3 +137,54 @@ jobs: <!--openapi-diff-workflow-comment--> No changes to OpenAPI specification found. See history of this comment for previous changes. + + publish: + name: OpenAPI - Publish Unstable Spec + if: + - github.event_name != 'pull_request' + - ${{ contains(github.repository_owner, 'jellyfin') }} + runs-on: ubuntu-latest + needs: + - openapi-head + steps: + - name: Set unstable dated version + id: version + run: |- + echo "JELLYFIN_VERSION=$(date +'%Y%m%d%H')" >> $GITHUB_ENV + - name: Download openapi-head + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + with: + name: openapi-head + path: openapi-head + - name: Upload openapi.json (unstable) to repository server + uses: appleboy/scp-action@917f8b81dfc1ccd331fef9e2d61bdc6c8be94634 # v0.1.7 + with: + host: "${{ secrets.REPO_HOST }}" + username: "${{ secrets.REPO_USER }}" + key: "${{ secrets.REPO_KEY }}" + source: openapi-head/openapi.json + strip_components: 1 + target: "/srv/incoming/openapi/unstable/jellyfin-openapi-${{ env.JELLYFIN_VERSION }}.json" + - name: Move openapi.json (unstable) into place + uses: appleboy/ssh-action@029f5b4aeeeb58fdfe1410a5d17f967dacf36262 # v1.0.3 + with: + host: "${{ secrets.REPO_HOST }}" + username: "${{ secrets.REPO_USER }}" + key: "${{ secrets.REPO_KEY }}" + debug: false + script_stop: false + script: | + TGT_DIR="/srv/repository/main/openapi" + LAST_SPEC="$( ls -lt ${TGT_DIR} | grep 'jellyfin-openapi' | head -1 | awk '{ print $NF }' )" + sudo mv /srv/incoming/openapi/unstable/jellyfin-openapi-${{ env.JELLYFIN_VERSION }}.json ${TGT_DIR}/unstable/ jellyfin-openapi-${{ env.JELLYFIN_VERSION }}.json + # Delete previous jellyfin-openapi-unstable_previous.json + sudo rm ${TGT_DIR}/jellyfin-openapi-unstable_previous.json + # Move current jellyfin-openapi-unstable.json symlink to jellyfin-openapi-unstable_previous.json + sudo mv ${TGT_DIR}/jellyfin-openapi-unstable.json ${TGT_DIR}/jellyfin-openapi-unstable_previous.json + # Create new jellyfin-openapi-stable.json symlink + sudo ln -s unstable/jellyfin-openapi-${{ env.JELLYFIN_VERSION }}.json ${TGT_DIR}/jellyfin-openapi-unstable.json + # Check that the previous openapi spec is correct + if [[ "$( readlink ${TGT_DIR}/jellyfin-openapi-unstable_previous.json )" != "unstable/${LAST_SPEC}" ]]; then + sudo rm ${TGT_DIR}/jellyfin-openapi-unstable_previous.json + sudo ln -s unstable/${LAST_SPEC} ${TGT_DIR}/jellyfin-openapi-unstable_previous.json + fi |
