From 66b08400b7a09931adefdd4db12cc12a70db5af1 Mon Sep 17 00:00:00 2001 From: Charles Ewert Date: Fri, 15 Dec 2023 20:47:11 -0500 Subject: [PATCH] Fix workflows (#1580) --- .github/workflows/automations.yml | 2 - .github/workflows/build-dev.yml | 5 +- .github/workflows/build-docs.yml | 2 +- .github/workflows/build-prod.yml | 55 +----------------- .github/workflows/deploy-api-docs.yml | 2 +- .github/workflows/lint.yml | 3 +- .github/workflows/release-prep.yml | 80 +++++++++++++++++++++++++++ 7 files changed, 88 insertions(+), 61 deletions(-) create mode 100644 .github/workflows/release-prep.yml diff --git a/.github/workflows/automations.yml b/.github/workflows/automations.yml index 20210f281..175a134f7 100644 --- a/.github/workflows/automations.yml +++ b/.github/workflows/automations.yml @@ -6,8 +6,6 @@ concurrency: on: push: - branches: - - unstable pull_request_target: jobs: diff --git a/.github/workflows/build-dev.yml b/.github/workflows/build-dev.yml index 759e7bd07..5436bc9dd 100644 --- a/.github/workflows/build-dev.yml +++ b/.github/workflows/build-dev.yml @@ -2,11 +2,10 @@ name: build-dev on: pull_request: - branches-ignore: - - master push: branches: - - unstable + - master + - "*.*.z" jobs: dev: diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index b380a1519..1f73cd514 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -3,7 +3,7 @@ name: build-docs on: push: branches: - - unstable + - master jobs: docs: diff --git a/.github/workflows/build-prod.yml b/.github/workflows/build-prod.yml index 096a6a5cf..9294e845f 100644 --- a/.github/workflows/build-prod.yml +++ b/.github/workflows/build-prod.yml @@ -1,64 +1,15 @@ +# Builds the production version of the app name: build-prod on: - pull_request: - branches: - - master push: branches: - master + - "*.*.z" jobs: - version-check: - runs-on: ubuntu-latest - steps: - - name: Checkout master (the latest release) - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 - with: - ref: master - - name: Install jq to parse json - uses: awalsh128/cache-apt-pkgs-action@latest - with: - packages: jq - - name: Save old package.json version - run: echo "oldPackVersion=$(jq -r ".version" package.json)" >> $GITHUB_ENV - - name: Find and save old major_version from manifest - run: awk 'BEGIN { FS="=" } /^major_version/ { print "oldMajor="$2; }' manifest >> $GITHUB_ENV - - name: Find and save old minor_version from manifest - run: awk 'BEGIN { FS="=" } /^minor_version/ { print "oldMinor="$2; }' manifest >> $GITHUB_ENV - - name: Find and save old build_version from manifest - run: awk 'BEGIN { FS="=" } /^build_version/ { print "oldBuild="$2; }' manifest >> $GITHUB_ENV - - 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 - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 - - name: Save new package.json version - run: echo "newPackVersion=$(jq -r ".version" package.json)" >> $GITHUB_ENV - - name: package.json version must be updated - 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 - - name: Manifest version must be updated - if: env.oldManVersion == env.newManVersion - run: exit 1 - - name: Save new Makefile version - run: awk 'BEGIN { FS=" := " } /^VERSION/ { print "newMakeVersion="$2; }' Makefile >> $GITHUB_ENV - - name: Makefile version must be updated - if: env.oldMakeVersion == env.newMakeVersion - run: exit 1 - - name: All new versions must match - if: (env.newManVersion != env.newPackVersion) || (env.newManVersion != env.newMakeVersion) - run: exit 1 prod: + if: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'release-prep') }} runs-on: ubuntu-latest steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 diff --git a/.github/workflows/deploy-api-docs.yml b/.github/workflows/deploy-api-docs.yml index b4a6787f1..eaf938519 100644 --- a/.github/workflows/deploy-api-docs.yml +++ b/.github/workflows/deploy-api-docs.yml @@ -3,7 +3,7 @@ name: deploy-api-docs on: push: - branches: ["unstable"] + branches: ["master"] paths: ["docs/**"] # only run if the docs are updated # Allows you to run this workflow manually from the Actions tab diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 349ee30af..1eebdf85c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -2,7 +2,6 @@ name: lint on: pull_request: - jobs: brightscript: runs-on: ubuntu-latest @@ -79,4 +78,4 @@ jobs: - name: Install roku package dependencies run: npx ropm install - name: Check markdown files for spelling errors - run: npm run lint-spelling \ No newline at end of file + run: npm run lint-spelling diff --git a/.github/workflows/release-prep.yml b/.github/workflows/release-prep.yml new file mode 100644 index 000000000..d8a1c51ec --- /dev/null +++ b/.github/workflows/release-prep.yml @@ -0,0 +1,80 @@ +# All of the jobs in this workflow will only run if the PR that triggered it has a 'release-prep' label +name: release-prep + +on: + pull_request: + types: [labeled, opened, reopened, synchronize] + +jobs: + version-check: + if: ${{ contains(github.event.pull_request.labels.*.name, 'release-prep') }} + runs-on: ubuntu-latest + steps: + - name: DEBUG ${{ github.event.pull_request.base.ref }} + run: echo ${{ github.event.pull_request.base.ref }} + - name: Checkout the branch this PR wants to update + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + with: + ref: ${{ github.event.pull_request.base.ref }} + - name: Install jq to parse json + uses: awalsh128/cache-apt-pkgs-action@latest + with: + packages: jq + - name: Save old package.json version + run: echo "oldPackVersion=$(jq -r ".version" package.json)" >> $GITHUB_ENV + - name: Find and save old major_version from manifest + run: awk 'BEGIN { FS="=" } /^major_version/ { print "oldMajor="$2; }' manifest >> $GITHUB_ENV + - name: Find and save old minor_version from manifest + run: awk 'BEGIN { FS="=" } /^minor_version/ { print "oldMinor="$2; }' manifest >> $GITHUB_ENV + - name: Find and save old build_version from manifest + run: awk 'BEGIN { FS="=" } /^build_version/ { print "oldBuild="$2; }' manifest >> $GITHUB_ENV + - 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 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + - name: Save new package.json version + run: echo "newPackVersion=$(jq -r ".version" package.json)" >> $GITHUB_ENV + - name: package.json version must be updated + 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 + - name: Manifest version must be updated + if: env.oldManVersion == env.newManVersion + run: exit 1 + - name: Save new Makefile version + run: awk 'BEGIN { FS=" := " } /^VERSION/ { print "newMakeVersion="$2; }' Makefile >> $GITHUB_ENV + - name: Makefile version must be updated + if: env.oldMakeVersion == env.newMakeVersion + run: exit 1 + - name: All new versions must match + if: (env.newManVersion != env.newPackVersion) || (env.newManVersion != env.newMakeVersion) + run: exit 1 + build-prod: + if: ${{ contains(github.event.pull_request.labels.*.name, 'release-prep') }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4 + with: + node-version: "lts/*" + cache: "npm" + - name: NPM install + run: npm ci + - name: Install roku module dependencies + run: npm run ropm + - name: Build app for production + run: npm run build-prod + - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3 + with: + name: Jellyfin-Roku-v${{ env.newManVersion }}-${{ github.sha }} + path: ${{ github.workspace }}/build/staging + if-no-files-found: error