diff --git a/.github/workflows/pr-build.yaml b/.github/workflows/pr-build.yaml index 1f2bf3267..81f163e32 100644 --- a/.github/workflows/pr-build.yaml +++ b/.github/workflows/pr-build.yaml @@ -3,12 +3,12 @@ name: PR Build on Dev on: pull_request: types: [labeled, synchronize] - paths: - - frontend/** - - backend/** + # paths: + # - frontend/** + # - backend/** env: - VERSION: 0.2.0 + # VERSION: 0.2.0 GIT_URL: https://github.com/bcgov/lcfs.git TOOLS_NAMESPACE: ${{ secrets.OPENSHIFT_NAMESPACE_PLATE }}-tools DEV_NAMESPACE: ${{ secrets.OPENSHIFT_NAMESPACE_PLATE }}-dev @@ -21,12 +21,30 @@ concurrency: jobs: + get-version: + if: contains(github.event.pull_request.labels.*.name, 'build') && github.event.pull_request.base.ref == "${{ github.event.repository.default_branch }}" + name: Retrieve version + runs-on: ubuntu-latest + + outputs: + output1: ${{ steps.get-version.outputs.VERSION }} + + steps: + - id: get-version + run: | + version=$(echo "${{ github.event.repository.default_branch }}" | sed -E 's/release-(.*)/\1/') + echo "VERSION=$version" >> $GITHUB_OUTPUT + build: - if: contains(github.event.pull_request.labels.*.name, 'build') + if: contains(github.event.pull_request.labels.*.name, 'build') && github.event.pull_request.base.ref == "${{ github.event.repository.default_branch }}" name: Build LCFS runs-on: ubuntu-latest + needs: [get-version] timeout-minutes: 60 + env: + VERSION: ${{ needs.get-version.outputs.output1 }} + steps: - name: Check out repository @@ -78,11 +96,14 @@ jobs: oc tag ${{ env.TOOLS_NAMESPACE }}/lcfs-frontend:${{ env.VERSION }}-${{ env.PR_NUMBER }} ${{ env.DEV_NAMESPACE }}/lcfs-frontend:${{ env.VERSION }}-${{ env.PR_NUMBER }} deploy: - if: contains(github.event.pull_request.labels.*.name, 'build') + if: contains(github.event.pull_request.labels.*.name, 'build') && github.event.pull_request.base.ref == "${{ github.event.repository.default_branch }}" name: Deploy LCFS runs-on: ubuntu-latest timeout-minutes: 60 - needs: [build] + needs: [get-version, build] + + env: + VERSION: ${{ needs.get-version.outputs.output1 }} steps: