Skip to content

Commit

Permalink
Merge pull request #477 from jellyfin/nvv-single-build
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsvanvelzen committed Oct 2, 2023
2 parents f101435 + 9fcaafe commit db89cf6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 27 deletions.
30 changes: 9 additions & 21 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
flavor: [development, production]

steps:
- name: Checkout
Expand All @@ -35,35 +32,27 @@ jobs:
PACKAGE_JSON=$(jq --indent 4 ".version += \"-$GITHUB_SHA\"" package.json)
echo $PACKAGE_JSON > package.json
- name: Build development
if: ${{ matrix.flavor == 'development' }}
run: npm run build:development

- name: Build production
if: ${{ matrix.flavor == 'production' }}
run: npm run build:production
- name: Build
run: npm run build

- name: Prepare artifacts
run: |
test -d dist
mv dist jellyfin-chromecast
zip -r "jellyfin-chromecast-${{ matrix.flavor }}.zip" "jellyfin-chromecast"
zip -r "jellyfin-chromecast.zip" "jellyfin-chromecast"
- name: Upload artifacts
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: jellyfin-chromecast-${{ matrix.flavor }}
path: jellyfin-chromecast-${{ matrix.flavor }}.zip
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]
strategy:
matrix:
flavor: [development, production]

steps:
- name: Set JELLYFIN_VERSION to git tag
Expand All @@ -77,29 +66,28 @@ jobs:
- name: Download artifact
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: jellyfin-chromecast-${{ matrix.flavor }}
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-${{ matrix.flavor }}.zip"]'
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-${{ matrix.flavor }}.zip
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@55dabf81b49d4120609345970c91507e2d734799 # v1.0.0
if: ${{ matrix.flavor == 'production' }}
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
Expand All @@ -109,7 +97,7 @@ jobs:
script: |
cd /srv/repository/releases/client/chromecast;
rm -rf *.zip;
ln -s versions/${JELLYFIN_VERSION}/jellyfin-chromecast-${{ matrix.flavor }}-${JELLYFIN_VERSION}.zip .;
ln -s versions/${JELLYFIN_VERSION}/jellyfin-chromecast-${JELLYFIN_VERSION}.zip .;
deploy:
name: Deploy
Expand Down
6 changes: 2 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@ The development environment is setup with editorconfig. Code style is enforced b

### Building/Using

`npm run build:development` - Build a development version

`npm start` - Build a development version and start a dev server

`npm run build:production` - Build a production version
`npm run build` - Build a production version

`npm run test` - Run tests

Expand All @@ -33,7 +31,7 @@ The development environment is setup with editorconfig. Code style is enforced b
3. Change `applicationStable` and `applicationUnstable` in `jellyfin-web/src/plugins/chromecastPlayer/plugin.js` to your own application ID.
4. Run the local copy of jellyfin-web using the provided instructions in the repo.
5. Clone this repo and run `npm install`. This will install all dependencies, run tests and build a production build by default.
6. Make changes and build with `npm run build:development`. `build:development` includes sourcemaps that'll make it easier to debug.
6. Make changes and build with `npm run build`.
7. Before pushing your changes, make sure to run `npm run test` and `npm run lint`.

> NOTE: It is recommended to symlink the `dist` folder pointing to a location on your web server hosting the files. That way you can refresh the cast receiver via the Chrome Remote Debugger and see your changes without having to manually copy after each build.
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@
"url": "git+https://github.com/jellyfin/jellyfin-chromecast.git"
},
"scripts": {
"build:development": "cross-env TS_NODE_PROJECT=\"tsconfig-webpack.json\" webpack --config webpack.config.ts --mode=development",
"build:production": "cross-env TS_NODE_PROJECT=\"tsconfig-webpack.json\" webpack --config webpack.config.ts --mode=production",
"build": "cross-env TS_NODE_PROJECT=\"tsconfig-webpack.json\" webpack --config webpack.config.ts --mode=production",
"lint": "npm run lint:code && npm run lint:css && npm run prettier",
"lint:code": "eslint --ext .ts,.js,.json .",
"lint:css": "stylelint **/*.css",
Expand Down

0 comments on commit db89cf6

Please sign in to comment.