From ad9d536fce71f6c71456054effb23ea4aa6ac0c5 Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Tue, 23 Feb 2021 18:57:37 -0500 Subject: [PATCH 1/6] Create test --- test | 1 + 1 file changed, 1 insertion(+) create mode 100644 test diff --git a/test b/test new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/test @@ -0,0 +1 @@ + From 94b03790becf6c3ef574844b75dc697421b76944 Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Tue, 23 Feb 2021 18:57:50 -0500 Subject: [PATCH 2/6] Delete test --- test | 1 - 1 file changed, 1 deletion(-) delete mode 100644 test diff --git a/test b/test deleted file mode 100644 index 8b1378917..000000000 --- a/test +++ /dev/null @@ -1 +0,0 @@ - From 531899fca904559626fd2a68bef8976acf70a78a Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Sun, 28 Mar 2021 13:03:10 -0400 Subject: [PATCH 3/6] Committed to master branch the updated workflows. --- .github/workflows/ci.yml | 46 +++++++++++++ .github/workflows/release_beta_to_dev.yaml | 65 ++++++++++++------- .github/workflows/release_dev_to_master.yaml | 62 ++++++++++++++++++ .../workflows/release_major_and_merge.yaml | 59 ----------------- .../workflows/release_minor_and_merge.yaml | 59 ----------------- .../workflows/release_patch_and_merge.yaml | 59 ----------------- .github/workflows/schedule.yaml | 50 ++++++++++++++ 7 files changed, 201 insertions(+), 199 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release_dev_to_master.yaml delete mode 100644 .github/workflows/release_major_and_merge.yaml delete mode 100644 .github/workflows/release_minor_and_merge.yaml delete mode 100644 .github/workflows/release_patch_and_merge.yaml create mode 100644 .github/workflows/schedule.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..c4d1f73e3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,46 @@ +name: CI + +on: + push: + branches: [development] + paths: + - frontend/** + - .github/workflows/ci.yml + pull_request: + branches: [development] + + +jobs: + Frontend: + runs-on: ubuntu-latest + env: + UI_DIRECTORY: ./frontend + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Cache node_modules + uses: actions/cache@v2 + with: + path: '${{ env.UI_DIRECTORY }}/node_modules' + key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }} + restore-keys: ${{ runner.os }}-modules- + + - name: Setup NodeJS + uses: actions/setup-node@v2 + with: + node-version: "15.x" + + - name: Install dependencies + run: npm install + working-directory: ${{ env.UI_DIRECTORY }} + + - name: Build + run: npm run build + working-directory: ${{ env.UI_DIRECTORY }} + + - uses: actions/upload-artifact@v2 + with: + name: "ui" + path: "${{ env.UI_DIRECTORY }}/build" diff --git a/.github/workflows/release_beta_to_dev.yaml b/.github/workflows/release_beta_to_dev.yaml index a5e08f63d..2883f6d43 100644 --- a/.github/workflows/release_beta_to_dev.yaml +++ b/.github/workflows/release_beta_to_dev.yaml @@ -1,39 +1,60 @@ name: release_beta_to_dev -on: - push: - branches: [ development ] +on: workflow_dispatch jobs: Release: runs-on: ubuntu-latest env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: true GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + UI_DIRECTORY: ./frontend + ASSET_DIRECTORY: ./__builds__ + FETCH_DEPTH: 15 # Should be enough steps: - - name: Checkout source code + - name: Validate branch + if: ${{ github.ref != 'refs/heads/development' }} + run: | + echo This action can only be run on development branch, not ${{ github.ref }} + exit 1 + + - name: Checkout uses: actions/checkout@v2 with: - fetch-depth: 0 + fetch-depth: ${{ env.FETCH_DEPTH }} ref: development + - name: Setup Git + run: | + git config --global user.name "github-actions" && + git fetch --depth ${{ env.FETCH_DEPTH }} --tags + + - name: Cache node_modules + uses: actions/cache@v2 + with: + path: '${{ env.UI_DIRECTORY }}/node_modules' + key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }} + restore-keys: ${{ runner.os }}-modules- + - name: Setup NodeJS uses: actions/setup-node@v2 with: - node-version: '15.x' - - run: npm install -D release-it - - run: npm install -D @release-it/bumper - - - id: latest_release - uses: pozetroninc/github-action-get-latest-release@master - with: - repository: ${{ github.repository }} - excludes: draft + node-version: "15.x" - - name: Define LAST_VERSION environment variable + - name: Install Global Tools + run: npm install -g release-it @release-it/bumper auto-changelog + + - name: Install UI Dependencies + run: npm install + working-directory: ${{ env.UI_DIRECTORY }} + + - name: Build & Stage UI + run: npm run build && git add . + working-directory: ${{ env.UI_DIRECTORY }} + + - name: Save UI to Asset run: | - echo "LAST_VERSION=${{steps.latest_release.outputs.release}}" >> $GITHUB_ENV - - - name: Update version and create release - uses: TheRealWaldo/release-it@v0.2.1 - with: - json-opts: '{"preRelease": true, "increment": "prepatch", "preReleaseId": "beta"}' \ No newline at end of file + mkdir -p ../.${{ env.ASSET_DIRECTORY }} && + zip -r ../.${{ env.ASSET_DIRECTORY }}/ui.zip ./ -x '*.map' -b $(mktemp -d) + working-directory: ${{ env.UI_DIRECTORY }}/build + + - name: Create Release + run: release-it --ci --increment prerelease --preRelease=beta diff --git a/.github/workflows/release_dev_to_master.yaml b/.github/workflows/release_dev_to_master.yaml new file mode 100644 index 000000000..afabd9acc --- /dev/null +++ b/.github/workflows/release_dev_to_master.yaml @@ -0,0 +1,62 @@ +name: release_dev_to_master +on: + workflow_dispatch: + inputs: + increment: + description: "Increment Type (major, minor, patch)" + required: true + default: "patch" + +jobs: + Release: + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + UI_DIRECTORY: ./frontend + ASSET_DIRECTORY: ./__builds__ + steps: + - name: Validate branch + if: ${{ github.ref != 'refs/heads/development' }} + run: | + echo This action can only be run on development branch, not ${{ github.ref }} + exit 1 + + - name: Checkout source code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + ref: development + + - name: Setup Git + run: git config --global user.name "github-actions" + + - name: Setup NodeJS + uses: actions/setup-node@v2 + with: + node-version: "15.x" + + - name: Install Global Tools + run: npm install -g release-it @release-it/bumper auto-changelog + + - name: Save UI to Asset + run: | + mkdir -p ../.${{ env.ASSET_DIRECTORY }} && + zip -r ../.${{ env.ASSET_DIRECTORY }}/ui.zip ./ -x '*.map' -b $(mktemp -d) + working-directory: ${{ env.UI_DIRECTORY }}/build + + - name: Create Release + run: release-it --ci --increment ${{ github.event.inputs.increment }} + Merge: + needs: Release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Merge development -> master + uses: devmasx/merge-branch@v1.3.1 + with: + type: now + from_branch: development + target_branch: master + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release_major_and_merge.yaml b/.github/workflows/release_major_and_merge.yaml deleted file mode 100644 index 4563a50ee..000000000 --- a/.github/workflows/release_major_and_merge.yaml +++ /dev/null @@ -1,59 +0,0 @@ -name: release_major_and_merge -on: - workflow_dispatch - -jobs: - Release: - runs-on: ubuntu-latest - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: true - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - steps: - - name: Validate branch - if: ${{ github.ref != 'refs/heads/development' }} - run: | - echo This action can only be run on development branch, not ${{ github.ref }} - exit 1 - - - name: Checkout source code - uses: actions/checkout@v2 - with: - fetch-depth: 0 - ref: development - - - name: Setup NodeJS - uses: actions/setup-node@v2 - with: - node-version: '15.x' - - run: npm install -D release-it - - run: npm install -D @release-it/bumper - - run: npm install -D auto-changelog - - - id: latest_release - uses: pozetroninc/github-action-get-latest-release@master - with: - repository: ${{ github.repository }} - excludes: prerelease, draft - - - name: Define LAST_VERSION environment variable - run: | - echo "LAST_VERSION=${{steps.latest_release.outputs.release}}" >> $GITHUB_ENV - - - name: Update version and create release - uses: TheRealWaldo/release-it@v0.2.1 - with: - json-opts: '{"increment": "major"}' - Merge: - needs: Release - runs-on: ubuntu-latest - steps: - - name: Checkout source code - uses: actions/checkout@v2 - - - name: Merge development -> master - uses: devmasx/merge-branch@v1.3.1 - with: - type: now - from_branch: development - target_branch: master - github_token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/release_minor_and_merge.yaml b/.github/workflows/release_minor_and_merge.yaml deleted file mode 100644 index c47fe3e4b..000000000 --- a/.github/workflows/release_minor_and_merge.yaml +++ /dev/null @@ -1,59 +0,0 @@ -name: release_minor_and_merge -on: - workflow_dispatch - -jobs: - Release: - runs-on: ubuntu-latest - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: true - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - steps: - - name: Validate branch - if: ${{ github.ref != 'refs/heads/development' }} - run: | - echo This action can only be run on development branch, not ${{ github.ref }} - exit 1 - - - name: Checkout source code - uses: actions/checkout@v2 - with: - fetch-depth: 0 - ref: development - - - name: Setup NodeJS - uses: actions/setup-node@v2 - with: - node-version: '15.x' - - run: npm install -D release-it - - run: npm install -D @release-it/bumper - - run: npm install -D auto-changelog - - - id: latest_release - uses: pozetroninc/github-action-get-latest-release@master - with: - repository: ${{ github.repository }} - excludes: prerelease, draft - - - name: Define LAST_VERSION environment variable - run: | - echo "LAST_VERSION=${{steps.latest_release.outputs.release}}" >> $GITHUB_ENV - - - name: Update version and create release - uses: TheRealWaldo/release-it@v0.2.1 - with: - json-opts: '{"increment": "minor"}' - Merge: - needs: Release - runs-on: ubuntu-latest - steps: - - name: Checkout source code - uses: actions/checkout@v2 - - - name: Merge development -> master - uses: devmasx/merge-branch@v1.3.1 - with: - type: now - from_branch: development - target_branch: master - github_token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/release_patch_and_merge.yaml b/.github/workflows/release_patch_and_merge.yaml deleted file mode 100644 index 0f31f3c36..000000000 --- a/.github/workflows/release_patch_and_merge.yaml +++ /dev/null @@ -1,59 +0,0 @@ -name: release_patch_and_merge -on: - workflow_dispatch - -jobs: - Release: - runs-on: ubuntu-latest - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: true - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - steps: - - name: Validate branch - if: ${{ github.ref != 'refs/heads/development' }} - run: | - echo This action can only be run on development branch, not ${{ github.ref }} - exit 1 - - - name: Checkout source code - uses: actions/checkout@v2 - with: - fetch-depth: 0 - ref: development - - - name: Setup NodeJS - uses: actions/setup-node@v2 - with: - node-version: '15.x' - - run: npm install -D release-it - - run: npm install -D @release-it/bumper - - run: npm install -D auto-changelog - - - id: latest_release - uses: pozetroninc/github-action-get-latest-release@master - with: - repository: ${{ github.repository }} - excludes: prerelease, draft - - - name: Define LAST_VERSION environment variable - run: | - echo "LAST_VERSION=${{steps.latest_release.outputs.release}}" >> $GITHUB_ENV - - - name: Update version and create release - uses: TheRealWaldo/release-it@v0.2.1 - with: - json-opts: '{"increment": "patch"}' - Merge: - needs: Release - runs-on: ubuntu-latest - steps: - - name: Checkout source code - uses: actions/checkout@v2 - - - name: Merge development -> master - uses: devmasx/merge-branch@v1.3.1 - with: - type: now - from_branch: development - target_branch: master - github_token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/schedule.yaml b/.github/workflows/schedule.yaml new file mode 100644 index 000000000..57ce3de97 --- /dev/null +++ b/.github/workflows/schedule.yaml @@ -0,0 +1,50 @@ +name: Schedule Trigger + +on: + schedule: + - cron: '0 6 * * *' + +jobs: + Release-Nightly: + runs-on: ubuntu-latest + env: + GITHUB_REPO: "morpheus65535/bazarr" + GIT_BRANCH: "development" + WORKFLOW_TO_TRIGGER: "release_beta_to_dev.yaml" + steps: + - name: Get Previous Version + uses: actions/cache@v2 + with: + path: ./LAST_VERSION_SAVED + key: bazarr-${{ env.GIT_BRANCH }}-${{ env.WORKFLOW_TO_TRIGGER }}-trigger + - name: Execute + run: | + echo "**** Checking branch ${{ env.GIT_BRANCH }} ****" + LATEST_VERSION=$(git ls-remote https://github.com/${{ env.GITHUB_REPO }}.git refs/heads/${{ env.GIT_BRANCH }} | cut -f1) + if [[ $? != 0 ]]; then + echo "**** Cannot get latest hash from GitHub, exiting... ****" + exit 1 + fi + FILE_TO_CHECK='./LAST_VERSION_SAVED' + PREV_VERSION=0 + [[ -f $FILE_TO_CHECK ]] && PREV_VERSION=$(cat $FILE_TO_CHECK) + echo "**** Previous version: $PREV_VERSION ****" + echo "**** Latest version: $LATEST_VERSION ****" + echo $LATEST_VERSION > $FILE_TO_CHECK + if [[ 16#$LATEST_VERSION -eq 16#$PREV_VERSION ]]; then + echo "**** No Changes Found ****" + else + echo "**** Changes Found ****" + if curl -sfX GET https://raw.githubusercontent.com/${{ env.GITHUB_REPO }}/${{ env.GIT_BRANCH }}/.github/workflows/${{ env.WORKFLOW_TO_TRIGGER }} > /dev/null 2>&1; then + echo "**** Workflow exists. Triggering workflow for branch ${{ env.GIT_BRANCH }} ****" + curl -iX POST \ + -H "Authorization: token ${{ secrets.WF_GITHUB_TOKEN }}" \ + -H "Accept: application/vnd.github.v3+json" \ + -d "{\"ref\":\"refs/heads/${{ env.GIT_BRANCH }}\"}" \ + https://api.github.com/repos/${{ env.GITHUB_REPO }}/actions/workflows/${{ env.WORKFLOW_TO_TRIGGER }}/dispatches + else + echo "**** Workflow doesn't exist! Skipping... ****" + fi + fi + + From bcf31196ba44b8e1b009fe06dfb8fae3008c100f Mon Sep 17 00:00:00 2001 From: Liang Yi Date: Mon, 29 Mar 2021 14:51:43 +0800 Subject: [PATCH 4/6] no log: Enabled workflow_dispatch on Schedule Trigger job --- .github/workflows/schedule.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/schedule.yaml b/.github/workflows/schedule.yaml index 57ce3de97..a1ea89120 100644 --- a/.github/workflows/schedule.yaml +++ b/.github/workflows/schedule.yaml @@ -3,6 +3,7 @@ name: Schedule Trigger on: schedule: - cron: '0 6 * * *' + workflow_dispatch: jobs: Release-Nightly: From 43254291f7498e98413bdec13a9ed26e298a4d4a Mon Sep 17 00:00:00 2001 From: Liang Yi Date: Mon, 29 Mar 2021 18:51:50 +0800 Subject: [PATCH 5/6] no log: Fix caches issue in schedule trigger action --- .github/workflows/schedule.yaml | 52 +++++++++++++++------------------ 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/.github/workflows/schedule.yaml b/.github/workflows/schedule.yaml index a1ea89120..027490d32 100644 --- a/.github/workflows/schedule.yaml +++ b/.github/workflows/schedule.yaml @@ -9,43 +9,39 @@ jobs: Release-Nightly: runs-on: ubuntu-latest env: - GITHUB_REPO: "morpheus65535/bazarr" GIT_BRANCH: "development" WORKFLOW_TO_TRIGGER: "release_beta_to_dev.yaml" steps: - - name: Get Previous Version - uses: actions/cache@v2 - with: - path: ./LAST_VERSION_SAVED - key: bazarr-${{ env.GIT_BRANCH }}-${{ env.WORKFLOW_TO_TRIGGER }}-trigger - - name: Execute + - name: Get Latest Version + id: latest-version run: | echo "**** Checking branch ${{ env.GIT_BRANCH }} ****" - LATEST_VERSION=$(git ls-remote https://github.com/${{ env.GITHUB_REPO }}.git refs/heads/${{ env.GIT_BRANCH }} | cut -f1) + LATEST_VERSION=$(git ls-remote https://github.com/${{ github.repository }}.git refs/heads/${{ env.GIT_BRANCH }} | cut -f1) if [[ $? != 0 ]]; then echo "**** Cannot get latest hash from GitHub, exiting... ****" exit 1 fi - FILE_TO_CHECK='./LAST_VERSION_SAVED' - PREV_VERSION=0 - [[ -f $FILE_TO_CHECK ]] && PREV_VERSION=$(cat $FILE_TO_CHECK) - echo "**** Previous version: $PREV_VERSION ****" echo "**** Latest version: $LATEST_VERSION ****" - echo $LATEST_VERSION > $FILE_TO_CHECK - if [[ 16#$LATEST_VERSION -eq 16#$PREV_VERSION ]]; then - echo "**** No Changes Found ****" + echo "::set-output name=LATEST_VERSION::$LATEST_VERSION" + - name: Get Last Trigger Cache + id: cache + uses: actions/cache@v2 + with: + path: ./LAST_VERSION_SAVED + key: bazarr-${{ env.GIT_BRANCH }}-${{ env.WORKFLOW_TO_TRIGGER }}-${{ steps.latest-version.outputs.LATEST_VERSION }} + - name: Execute + if: steps.cache.outputs.cache-hit != 'true' + run: | + echo "**** Trigging ${{ env.WORKFLOW_TO_TRIGGER }} of branch ${{ env.GIT_BRANCH }} ****" + FILE_TO_WRITE='./LAST_VERSION_SAVED' + if curl -sfX GET https://raw.githubusercontent.com/${{ github.repository }}/${{ env.GIT_BRANCH }}/.github/workflows/${{ env.WORKFLOW_TO_TRIGGER }} > /dev/null 2>&1; then + echo "**** Workflow exists. Triggering workflow for branch ${{ env.GIT_BRANCH }} ****" + curl -ifX POST \ + -H "Authorization: token ${{ secrets.WF_GITHUB_TOKEN }}" \ + -H "Accept: application/vnd.github.v3+json" \ + -d "{\"ref\":\"refs/heads/${{ env.GIT_BRANCH }}\"}" \ + https://api.github.com/repos/${{ github.repository }}/actions/workflows/${{ env.WORKFLOW_TO_TRIGGER }}/dispatches + echo "1" > $FILE_TO_WRITE else - echo "**** Changes Found ****" - if curl -sfX GET https://raw.githubusercontent.com/${{ env.GITHUB_REPO }}/${{ env.GIT_BRANCH }}/.github/workflows/${{ env.WORKFLOW_TO_TRIGGER }} > /dev/null 2>&1; then - echo "**** Workflow exists. Triggering workflow for branch ${{ env.GIT_BRANCH }} ****" - curl -iX POST \ - -H "Authorization: token ${{ secrets.WF_GITHUB_TOKEN }}" \ - -H "Accept: application/vnd.github.v3+json" \ - -d "{\"ref\":\"refs/heads/${{ env.GIT_BRANCH }}\"}" \ - https://api.github.com/repos/${{ env.GITHUB_REPO }}/actions/workflows/${{ env.WORKFLOW_TO_TRIGGER }}/dispatches - else - echo "**** Workflow doesn't exist! Skipping... ****" - fi + echo "**** Workflow doesn't exist! Skipping... ****" fi - - From 1dbad1f1e794b13d4715b555c501c78a1eb1306b Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Wed, 14 Apr 2021 20:13:07 -0400 Subject: [PATCH 6/6] Updated wiki link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index afaad0d29..a0eff4e56 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ At the request of some, here is a way to demonstrate your appreciation for the e [![Discord](https://img.shields.io/badge/discord-chat-MH2e2eb.svg?style=flat-square)](https://discord.gg/MH2e2eb) # Support -For installation and configuration instructions, see [wiki](https://github.com/morpheus65535/bazarr/wiki). +For installation and configuration instructions, see [wiki](https://wiki.bazarr.media). You can reach us for support on [Discord](https://discord.gg/MH2e2eb).