Merge pull request #532 from jellyfin/renovate/tests #2
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: | |
push: | |
branches: | |
- master | |
tags: | |
- '*' | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Setup node env | |
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: npm ci --no-audit | |
- name: Update version in package.json | |
run: | | |
PACKAGE_JSON=$(jq --indent 4 ".version += \"-$GITHUB_SHA\"" package.json) | |
echo $PACKAGE_JSON > package.json | |
- name: Build | |
run: npm run build | |
- name: Prepare artifacts | |
run: | | |
test -d dist | |
mv dist jellyfin-chromecast | |
zip -r "jellyfin-chromecast.zip" "jellyfin-chromecast" | |
- name: Upload artifacts | |
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 | |
with: | |
name: jellyfin-chromecast | |
path: jellyfin-chromecast.zip | |
if-no-files-found: error | |
publish: | |
name: Publish | |
runs-on: ubuntu-latest | |
if: ${{ contains(github.repository_owner, 'jellyfin') && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')) }} | |
needs: [build] | |
steps: | |
- name: Set JELLYFIN_VERSION to git tag | |
if: ${{ startsWith(github.ref, 'refs/tags') }} | |
run: echo "JELLYFIN_VERSION=$(echo ${GITHUB_REF#refs/tags/v} | tr / -)" >> $GITHUB_ENV | |
- name: Set JELLYFIN_VERSION to unstable | |
if: ${{ github.ref == 'refs/heads/master' }} | |
run: echo "JELLYFIN_VERSION=unstable" >> $GITHUB_ENV | |
- name: Download artifact | |
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2 | |
with: | |
name: jellyfin-chromecast | |
- name: Upload release archive to GitHub release | |
if: ${{ startsWith(github.ref, 'refs/tags') }} | |
uses: alexellis/upload-assets@259de5111cb56966d046ced998941e93f91d2c93 # tag=0.4.0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.JF_BOT_TOKEN }} | |
with: | |
asset_paths: '["jellyfin-chromecast.zip"]' | |
- name: Upload release archive to repo.jellyfin.org | |
uses: burnett01/rsync-deployments@45d84ad5f6c174f3e0ffc50e9060a9666d09c16e # 6.0.0 | |
with: | |
switches: -vrptz | |
path: jellyfin-chromecast.zip | |
remote_path: /srv/repository/releases/client/chromecast/versions/${{ env.JELLYFIN_VERSION }}/ | |
remote_host: ${{ secrets.DEPLOY_HOST }} | |
remote_user: ${{ secrets.DEPLOY_USER }} | |
remote_key: ${{ secrets.DEPLOY_KEY }} | |
- name: Update repo.jellyfin.org symlinks | |
uses: appleboy/ssh-action@029f5b4aeeeb58fdfe1410a5d17f967dacf36262 # v1.0.3 | |
with: | |
host: ${{ secrets.DEPLOY_HOST }} | |
username: ${{ secrets.DEPLOY_USER }} | |
key: ${{ secrets.DEPLOY_KEY }} | |
envs: JELLYFIN_VERSION | |
script_stop: true | |
script: | | |
cd /srv/repository/releases/client/chromecast; | |
rm -rf *.zip; | |
ln -s versions/${JELLYFIN_VERSION}/jellyfin-chromecast-${JELLYFIN_VERSION}.zip .; | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
if: ${{ contains(github.repository_owner, 'jellyfin') && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')) }} | |
needs: [build] | |
steps: | |
- name: Download Artifact | |
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2 | |
with: | |
name: jellyfin-chromecast | |
- name: Unzip artifact | |
run: unzip jellyfin-chromecast.zip -d . | |
- name: Deploy to apps1.jellyfin.org/chromecast/nightly | |
uses: burnett01/rsync-deployments@45d84ad5f6c174f3e0ffc50e9060a9666d09c16e # 6.0.0 | |
with: | |
switches: -vrptz | |
path: jellyfin-chromecast/ | |
remote_path: /srv/chromecast/nightly/ | |
remote_host: ${{ secrets.DEPLOY_CC_HOST }} | |
remote_user: ${{ secrets.DEPLOY_CC_USER }} | |
remote_key: ${{ secrets.DEPLOY_CC_KEY }} | |
- name: Deploy to apps1.jellyfin.org/chromecast/stable | |
if: ${{ startsWith(github.ref, 'refs/tags') }} | |
uses: burnett01/rsync-deployments@45d84ad5f6c174f3e0ffc50e9060a9666d09c16e # 6.0.0 | |
with: | |
switches: -vrptz | |
path: jellyfin-chromecast/ | |
remote_path: /srv/chromecast/stable/ | |
remote_host: ${{ secrets.DEPLOY_CC_HOST }} | |
remote_user: ${{ secrets.DEPLOY_CC_USER }} | |
remote_key: ${{ secrets.DEPLOY_CC_KEY }} |