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-06-09 15:27:19 +00:00
|
|
|
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
|
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-06-09 15:27:19 +00:00
|
|
|
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
|
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-06-09 15:27:19 +00:00
|
|
|
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
|
2023-07-06 06:19:12 +00:00
|
|
|
- uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3
|
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-01-06 15:39:49 +00:00
|
|
|
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # 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
|