Skip to content

Commit

Permalink
update criteria
Browse files Browse the repository at this point in the history
  • Loading branch information
kuanfandevops committed Jul 26, 2024
1 parent 939722a commit 2531476
Showing 1 changed file with 28 additions and 7 deletions.
35 changes: 28 additions & 7 deletions .github/workflows/pr-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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:

Expand Down

0 comments on commit 2531476

Please sign in to comment.