feat: return descriptions for HWCR export #444
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PR | |
on: | |
pull_request: | |
concurrency: | |
# Cancel in progress for PR open and close | |
group: ${{ github.workflow }}-${{ github.event.number }} | |
cancel-in-progress: true | |
jobs: | |
# https://github.com/bcgov-nr/action-builder-ghcr | |
builds: | |
name: Builds | |
runs-on: ubuntu-22.04 | |
permissions: | |
packages: write | |
outputs: | |
digest: ${{ steps.builds.outputs.digest }} | |
sha: ${{ github.sha }} | |
strategy: | |
matrix: | |
package: [migrations, backend] | |
timeout-minutes: 10 | |
steps: | |
- uses: bcgov-nr/[email protected] | |
id: builds | |
with: | |
keep_versions: 50 | |
package: ${{ matrix.package }} | |
tag: ${{ github.event.number }} | |
tag_fallback: latest | |
triggers: ('${{ matrix.package }}/') | |
- uses: shrink/actions-docker-registry-tag@v4 | |
with: | |
registry: ghcr.io | |
repository: ${{ github.repository }}/${{ matrix.package }} | |
target: ${{ github.event.number }} | |
tags: | | |
${{ github.sha }} | |
# https://github.com/bcgov-nr/action-deployer-openshift | |
deploys: | |
name: Deploys | |
needs: [builds] | |
environment: dev | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout CD repo | |
uses: actions/checkout@v4 | |
with: | |
repository: bcgov-c/tenant-gitops-dc0a4a | |
ssh-key: ${{ secrets.MANIFEST_REPO_DEPLOY_KEY }} | |
ref: main | |
- name: Calculate Deployment Number | |
id: get-deployment-number | |
shell: bash | |
run: | | |
PR_NUMBER=$(echo ${{ github.event.number }}) | |
PR_NUMBER_MOD_FIVE=$(($PR_NUMBER % 5)) | |
echo "DEPLOYMENT_NUMBER=$(($PR_NUMBER_MOD_FIVE + 1))" >> $GITHUB_OUTPUT | |
- name: Configure git | |
# From https://github.com/orgs/community/discussions/26560#discussioncomment-3531273 | |
run: | | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
- name: Update image tag And Enable it for deployment | |
run: | | |
DEPLOYMENT_NUMBER=${{ steps.get-deployment-number.outputs.DEPLOYMENT_NUMBER }} | |
cd charts/nr-compliance-enforcement-cm | |
yq eval '.global.enabled=true' -i values-"$DEPLOYMENT_NUMBER".yaml | |
yq eval '.global.tag="${{ needs.builds.outputs.sha }}"' -i values-"$DEPLOYMENT_NUMBER".yaml | |
- name: Commit and push update | |
shell: bash | |
run: | | |
git commit -am "Update image tag for pull request deployment and enable it for values-${{ steps.get-deployment-number.outputs.DEPLOYMENT_NUMBER }}.yaml" | |
git push origin main | |
validate: | |
name: Validate | |
needs: [deploys] | |
if: always() && (!cancelled()) && (!failure()) | |
env: | |
DOMAIN: apps.emerald.devops.gov.bc.ca | |
PREFIX: ${{ github.event.repository.name }} | |
permissions: | |
pull-requests: write | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: amannn/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- if: failure() | |
run: | | |
echo "Please use conventional commits in your PR title and re-run this job." | |
echo "https://www.conventionalcommits.org/en/v1.0.0/" | |
exit 1 | |
- uses: bcgov-nr/[email protected] | |
env: | |
DOMAIN: apps.silver.devops.gov.bc.ca | |
PREFIX: ${{ github.event.repository.name }} | |
with: | |
add_markdown: | | |
--- | |
Thanks for the PR! | |
Deployments, as required, will be available below: | |
- [Backend](https://${{ env.PREFIX }}-${{ github.event.number }}-backend.${{ env.DOMAIN }}/api) | |
Please create PRs in draft mode. Mark as ready to enable: | |
- [Analysis Workflow](https://github.com/${{ github.repository }}/actions/workflows/analysis.yml) | |
After merge, new images are deployed in: | |
- [Merge Workflow](https://github.com/${{ github.repository }}/actions/workflows/merge.yml) |