-
-
Notifications
You must be signed in to change notification settings - Fork 43
140 lines (119 loc) · 5.68 KB
/
publish.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup node env
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
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@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
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@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: jellyfin-chromecast
- name: Upload release archive to GitHub release
if: ${{ startsWith(github.ref, 'refs/tags') }}
uses: alexellis/upload-assets@13926a61cdb2cb35f5fdef1c06b8b591523236d3 # 0.4.1
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@796cf0d5e4b535745ce49d7429f77cf39e25ef39 # 7.0.1
with:
switches: -vrptz
path: jellyfin-chromecast.zip
remote_path: /srv/incoming/chromecast/${{ env.JELLYFIN_VERSION }}/
remote_host: ${{ secrets.REPO_HOST }}
remote_user: ${{ secrets.REPO_USER }}
remote_key: ${{ secrets.REPO_KEY }}
- name: Update repo.jellyfin.org symlinks
uses: appleboy/ssh-action@7eaf76671a0d7eec5d98ee897acda4f968735a17 # v1.2.0
with:
host: ${{ secrets.REPO_HOST }}
username: ${{ secrets.REPO_USER }}
key: ${{ secrets.REPO_KEY }}
envs: JELLYFIN_VERSION
script_stop: true
script: |
if [ -d "/srv/repository/main/client/chromecast/versions/${{ env.JELLYFIN_VERSION }}" ] && [ -n "${{ env.JELLYFIN_VERSION }}" ]; then
sudo rm -r /srv/repository/main/client/chromecast/versions/${{ env.JELLYFIN_VERSION }};
fi
sudo mv /srv/incoming/chromecast/${{ env.JELLYFIN_VERSION }} /srv/repository/main/client/chromecast/versions/${{ env.JELLYFIN_VERSION }};
cd /srv/repository/main/client/chromecast;
sudo rm -rf *.zip;
sudo 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@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
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@796cf0d5e4b535745ce49d7429f77cf39e25ef39 # 7.0.1
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@796cf0d5e4b535745ce49d7429f77cf39e25ef39 # 7.0.1
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 }}