2023-05-03 21:21:04 +00:00
|
|
|
name: build-prod
|
2023-02-25 18:29:04 +00:00
|
|
|
|
2022-09-03 12:08:45 +00:00
|
|
|
on:
|
2023-03-06 01:10:31 +00:00
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- master
|
2022-09-03 12:08:45 +00:00
|
|
|
push:
|
2023-02-25 18:29:04 +00:00
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
|
2022-09-03 12:08:45 +00:00
|
|
|
jobs:
|
2023-03-06 01:10:31 +00:00
|
|
|
version-check:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-03-07 00:19:10 +00:00
|
|
|
- name: Checkout master (the latest release)
|
2023-10-27 02:46:04 +00:00
|
|
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
|
2023-03-06 01:10:31 +00:00
|
|
|
with:
|
|
|
|
ref: master
|
2023-03-07 01:16:22 +00:00
|
|
|
- name: Install jq to parse json
|
2023-03-07 00:19:10 +00:00
|
|
|
uses: awalsh128/cache-apt-pkgs-action@latest
|
|
|
|
with:
|
|
|
|
packages: jq
|
|
|
|
- name: Save old package.json version
|
2023-03-07 01:16:22 +00:00
|
|
|
run: echo "oldPackVersion=$(jq -r ".version" package.json)" >> $GITHUB_ENV
|
2023-03-07 00:19:10 +00:00
|
|
|
- name: Find and save old major_version from manifest
|
2023-03-06 01:10:31 +00:00
|
|
|
run: awk 'BEGIN { FS="=" } /^major_version/ { print "oldMajor="$2; }' manifest >> $GITHUB_ENV
|
2023-03-07 00:19:10 +00:00
|
|
|
- name: Find and save old minor_version from manifest
|
2023-03-06 01:10:31 +00:00
|
|
|
run: awk 'BEGIN { FS="=" } /^minor_version/ { print "oldMinor="$2; }' manifest >> $GITHUB_ENV
|
2023-03-07 00:19:10 +00:00
|
|
|
- name: Find and save old build_version from manifest
|
2023-03-06 01:10:31 +00:00
|
|
|
run: awk 'BEGIN { FS="=" } /^build_version/ { print "oldBuild="$2; }' manifest >> $GITHUB_ENV
|
2023-03-07 00:19:10 +00:00
|
|
|
- name: Save old manifest version
|
|
|
|
run: echo "oldManVersion=${{ env.oldMajor }}.${{ env.oldMinor }}.${{ env.oldBuild }}" >> $GITHUB_ENV
|
|
|
|
- name: Save old Makefile version
|
|
|
|
run: awk 'BEGIN { FS=" = " } /^VERSION/ { print "oldMakeVersion="$2; }' Makefile >> $GITHUB_ENV
|
|
|
|
- name: Checkout PR branch
|
2023-10-27 02:46:04 +00:00
|
|
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
|
2023-03-07 00:19:10 +00:00
|
|
|
- name: Save new package.json version
|
2023-03-07 01:16:22 +00:00
|
|
|
run: echo "newPackVersion=$(jq -r ".version" package.json)" >> $GITHUB_ENV
|
|
|
|
- name: package.json version must be updated
|
2023-03-07 00:19:10 +00:00
|
|
|
if: env.oldPackVersion == env.newPackVersion
|
|
|
|
run: exit 1
|
|
|
|
- name: Find and save new major_version from manifest
|
|
|
|
run: awk 'BEGIN { FS="=" } /^major_version/ { print "newMajor="$2; }' manifest >> $GITHUB_ENV
|
|
|
|
- name: Find and save new minor_version from manifest
|
|
|
|
run: awk 'BEGIN { FS="=" } /^minor_version/ { print "newMinor="$2; }' manifest >> $GITHUB_ENV
|
|
|
|
- name: Find and save new build_version from manifest
|
|
|
|
run: awk 'BEGIN { FS="=" } /^build_version/ { print "newBuild="$2; }' manifest >> $GITHUB_ENV
|
|
|
|
- name: Save new manifest version
|
|
|
|
run: echo "newManVersion=${{ env.newMajor }}.${{ env.newMinor }}.${{ env.newBuild }}" >> $GITHUB_ENV
|
2023-03-07 01:16:22 +00:00
|
|
|
- name: Manifest version must be updated
|
2023-03-07 00:19:10 +00:00
|
|
|
if: env.oldManVersion == env.newManVersion
|
|
|
|
run: exit 1
|
|
|
|
- name: Save new Makefile version
|
|
|
|
run: awk 'BEGIN { FS=" = " } /^VERSION/ { print "newMakeVersion="$2; }' Makefile >> $GITHUB_ENV
|
2023-03-07 01:16:22 +00:00
|
|
|
- name: Makefile version must be updated
|
2023-03-07 00:19:10 +00:00
|
|
|
if: env.oldMakeVersion == env.newMakeVersion
|
|
|
|
run: exit 1
|
|
|
|
- name: All new versions must match
|
2023-03-07 01:16:22 +00:00
|
|
|
if: (env.newManVersion != env.newPackVersion) || (env.newManVersion != env.newMakeVersion)
|
2023-03-06 01:10:31 +00:00
|
|
|
run: exit 1
|
2023-02-25 18:29:04 +00:00
|
|
|
prod:
|
2023-02-22 18:34:38 +00:00
|
|
|
runs-on: ubuntu-latest
|
2022-09-03 12:08:45 +00:00
|
|
|
steps:
|
2023-10-27 02:46:04 +00:00
|
|
|
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
|
2023-10-27 02:47:37 +00:00
|
|
|
- uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4
|
2022-09-03 12:08:45 +00:00
|
|
|
with:
|
2023-02-22 18:34:38 +00:00
|
|
|
node-version: "lts/*"
|
|
|
|
cache: "npm"
|
2023-05-03 21:21:04 +00:00
|
|
|
- name: NPM install
|
|
|
|
run: npm ci
|
|
|
|
- name: Install roku module dependencies
|
2023-06-23 17:09:36 +00:00
|
|
|
run: npm run ropm
|
2023-05-03 21:21:04 +00:00
|
|
|
- name: Build app for production
|
|
|
|
run: npm run build-prod
|
2023-09-06 21:37:58 +00:00
|
|
|
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3
|
2022-09-03 12:08:45 +00:00
|
|
|
with:
|
2023-05-03 21:21:04 +00:00
|
|
|
name: Jellyfin-Roku-v${{ env.newManVersion }}-${{ github.sha }}
|
|
|
|
path: ${{ github.workspace }}/build/staging
|
2023-06-23 17:09:36 +00:00
|
|
|
if-no-files-found: error
|