diff --git a/.github/workflows/release_beta_to_dev.yaml b/.github/workflows/release_beta_to_dev.yaml index b4a005231..a6cf11ee8 100644 --- a/.github/workflows/release_beta_to_dev.yaml +++ b/.github/workflows/release_beta_to_dev.yaml @@ -52,22 +52,12 @@ jobs: working-directory: ${{ env.UI_DIRECTORY }} # TODO: Remove Stage Step - - name: Create Release - run: release-it --ci --increment prerelease --preRelease=beta - - # The following steps are a hack to schedule.yaml - # TODO: Remove this when we are no longer using @release-it/bumper to update VERSION file and push a new commit to the repo - - name: (Hack) Get Latest Version - id: current-version + - name: Create Release (Conditional) run: | - CURRENT_VERSION=$(git rev-parse HEAD) - echo "::set-output name=CURRENT_VERSION::$CURRENT_VERSION" - - - name: (Hack) Generate Schedule Cache - uses: actions/cache@v2 - with: - path: ./LAST_VERSION_SAVED - key: bazarr-development-release_beta_to_dev.yaml-${{ steps.current-version.outputs.CURRENT_VERSION }} - - - name: (Hack) Cache Current Version - run: echo "1" > LAST_VERSION_SAVED \ No newline at end of file + revision_count=$(git rev-list $(git describe --tags --abbrev=0)..HEAD --count) + if [[ $revision_count != 0 ]]; then + echo "**** Found $revision_count changes! Releasing... ****" + release-it --ci --increment prerelease --preRelease=beta + else + echo "**** Cannot find changes! Skipping... ****" + fi \ No newline at end of file diff --git a/.github/workflows/schedule.yaml b/.github/workflows/schedule.yaml index 027490d32..f8330651c 100644 --- a/.github/workflows/schedule.yaml +++ b/.github/workflows/schedule.yaml @@ -12,28 +12,9 @@ jobs: GIT_BRANCH: "development" WORKFLOW_TO_TRIGGER: "release_beta_to_dev.yaml" steps: - - name: Get Latest Version - id: latest-version - run: | - echo "**** Checking branch ${{ env.GIT_BRANCH }} ****" - 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 - echo "**** Latest version: $LATEST_VERSION ****" - 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 \ @@ -41,7 +22,6 @@ jobs: -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 "**** Workflow doesn't exist! Skipping... ****" fi