Skip to content

Commit

Permalink
Merge pull request #22 from bcgov-nr/feat/branchSupport
Browse files Browse the repository at this point in the history
feat: branch support for deployments
  • Loading branch information
andrwils authored Feb 15, 2024
2 parents 5166bed + e6dc310 commit b439b8f
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions generator-nr-maven-build/generators/app/templates/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Java CI

on:
pull_request:
branches: [main]
Expand Down Expand Up @@ -30,6 +31,7 @@ jobs:
outputs:
project_version: ${{ steps.set-build-output-parameters.outputs.project_version }}
intention_id: ${{ steps.set-intention-id.outputs.intention_id }}
branch: ${{ steps.set-branch-ci.outputs.branch }}

steps:
- uses: actions/checkout@v4
Expand All @@ -43,6 +45,13 @@ jobs:
server-username: ARTIFACTORY_USERNAME
server-password: ARTIFACTORY_PASSWORD

# Get branch for manual runs
- name: Get branch
id: set-branch-ci
if: ${{ startsWith(github.ref, 'refs/heads/') }}
run: |
echo "branch=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
- name: Set build output parameters
id: set-build-output-parameters
run: |
Expand Down Expand Up @@ -163,10 +172,17 @@ jobs:
url: https://cd.io.nrs.gov.bc.ca
PROJECT_VERSION: ${{ needs.publish.outputs.project_version }}
INTENTION_ID: ${{ needs.publish.outputs.intention_id }}
BRANCH: ${{ needs.publish.outputs.branch }}
run: |
curl --data-urlencode "token=${{ secrets.JENKINS_TOKEN }}" --data-urlencode "githubToken=${{ secrets.GITHUB_TOKEN }}" \
--data-urlencode "artifactoryBuildNumber=${{ github.run_number }}" --data-urlencode "cdVersion=${{ env.PROJECT_VERSION }}" \
--data-urlencode "intentionId=${{ env.INTENTION_ID }}" -H "Connection: close" ${{ env.url }}/${{ env.job }}
curl \
--data-urlencode "token=${{ secrets.JENKINS_TOKEN }}" \
--data-urlencode "githubToken=${{ secrets.GITHUB_TOKEN }}" \
--data-urlencode "artifactoryBuildNumber=${{ github.run_number }}" \
--data-urlencode "cdVersion=${{ env.PROJECT_VERSION }}" \
--data-urlencode "gitBranch=${{ env.BRANCH }}" \
--data-urlencode "intentionId=${{ env.INTENTION_ID }}" \
-H "Connection: close" \
${{ env.url }}/${{ env.job }}
# The automatically generated GitHub token will expire when the workflow ends. We need to wait so the job has time to clone the repo.
- name: Sleep for 30 seconds
run: sleep 30s
Expand Down

0 comments on commit b439b8f

Please sign in to comment.