Skip to content

Commit

Permalink
fix: get PR only when the tag is not provided. (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
mishraomp authored Oct 14, 2024
1 parent 24a2cdd commit 6497824
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/.deployer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
triggers: ${{ inputs.triggers }}

# Variables
- if: steps.triggers.outputs.triggered == 'true'
- if: ${{ steps.triggers.outputs.triggered == 'true' && inputs.tag == '' }}
id: pr
uses: bcgov-nr/action-get-pr@v0.0.1
- if: steps.triggers.outputs.triggered == 'true'
Expand All @@ -94,15 +94,20 @@ jobs:
tag=${{ inputs.tag || steps.pr.outputs.pr }}
# Release name includes run numbers to ensure uniqueness
release=${{ github.event.repository.name }}-${{ inputs.environment || steps.pr.outputs.pr }}
# Summary
release=${{ github.event.repository.name }}-${{ inputs.environment || steps.pr.outputs.pr || inputs.tag }}
# version, to support helm packaging for non-pr based releases (workflow_dispatch). default to 1.0.0+github run number
version=1.0.0+${{ github.run_number }}
# Summary
echo "tag=${tag}"
echo "release=${release}"
echo "version=${version}"
# Output
echo "tag=${tag}" >> $GITHUB_OUTPUT
echo "release=${release}" >> $GITHUB_OUTPUT
echo "version=${version}" >> $GITHUB_OUTPUT
### Deploy
- name: Install CLI tools from OpenShift Mirror
Expand Down Expand Up @@ -141,7 +146,7 @@ jobs:
run: |
# Helm package
sed -i 's/^name:.*/name: ${{ github.event.repository.name }}/' Chart.yaml
helm package -u . --app-version="tag-${{ steps.vars.outputs.tag }}_run-${{ github.run_number }}" --version=${{ steps.pr.outputs.pr }}
helm package -u . --app-version="tag-${{ steps.vars.outputs.tag }}_run-${{ github.run_number }}" --version=${{ steps.pr.outputs.pr || steps.vars.outputs.version }}
# Deploy Helm chart as atomic, with timeout
- if: steps.triggers.outputs.triggered == 'true' && inputs.atomic != 'false'
Expand All @@ -155,7 +160,7 @@ jobs:
--install --wait --atomic ${{ steps.vars.outputs.release }} \
--timeout ${{ inputs.timeout-minutes }}m \
--values ${{ inputs.values }} \
./${{ github.event.repository.name }}-${{ steps.pr.outputs.pr }}.tgz
./${{ github.event.repository.name }}-${{ steps.pr.outputs.pr || steps.vars.outputs.version }}.tgz
# Deploy Helm chart without atomic or timeout
- if: steps.triggers.outputs.triggered == 'true' && inputs.atomic == 'false'
Expand All @@ -168,7 +173,7 @@ jobs:
${{ inputs.params }} \
${{ steps.vars.outputs.release }} \
--install --wait --values ${{ inputs.values }} \
./${{ github.event.repository.name }}-${{ steps.pr.outputs.pr }}.tgz
./${{ github.event.repository.name }}-${{ steps.pr.outputs.pr || steps.vars.outputs.version }}.tgz
# Helm release history
- if: steps.triggers.outputs.triggered == 'true'
Expand Down

0 comments on commit 6497824

Please sign in to comment.