Skip to content

Commit

Permalink
Cleanup, reduce
Browse files Browse the repository at this point in the history
  • Loading branch information
DerekRoberts committed Sep 28, 2023
1 parent 7e129a7 commit 5822e74
Show file tree
Hide file tree
Showing 3 changed files with 155 additions and 11 deletions.
152 changes: 152 additions & 0 deletions .github/workflows/merge-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
name: Merge

on:
workflow_run:
workflows: [PR Closed]
types: [completed]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true

jobs:
deploys-test:
name: Deploy images to test
uses: ./.github/workflows/deploy.yml
with:
environment: 'test'
imagetag: 'latest' # we promote AFTER successful deploy of candidate
vault_zone: 'test'
zone: 'test'
secrets: inherit

image-promotion-test:
name: Tag images with test
needs: [deploys-test]
runs-on: ubuntu-22.04
strategy:
matrix:
component: [backend/vehicles, backend/dops, frontend]
steps:
- uses: shrink/actions-docker-registry-tag@v3
with:
registry: ghcr.io
repository: ${{ github.repository }}/${{ matrix.component }}
target: latest
tags: test

GitVersion:
name: Mainline Versioning - GitVersion
needs: [deploys-test]
runs-on: ubuntu-22.04
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }} # checkout the correct branch name
fetch-depth: 0 # fetch the whole repo history

- name: Setup GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: "5.x"

- name: Determine SemVersion
id: gitversion
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true
configFilePath: GitVersion.yaml

- name: Display GitVersion outputs
run: |
echo "Major: ${{ steps.gitversion.outputs.major }}"
echo "Minor: ${{ steps.gitversion.outputs.minor }}"
echo "Patch: ${{ steps.gitversion.outputs.patch }}"
echo "PreReleaseTag: ${{ steps.gitversion.outputs.preReleaseTag }}"
echo "PreReleaseTagWithDash: ${{ steps.gitversion.outputs.preReleaseTagWithDash }}"
echo "PreReleaseLabel: ${{ steps.gitversion.outputs.preReleaseLabel }}"
echo "PreReleaseNumber: ${{ steps.gitversion.outputs.preReleaseNumber }}"
echo "WeightedPreReleaseNumber: ${{ steps.gitversion.outputs.weightedPreReleaseNumber }}"
echo "BuildMetaData: ${{ steps.gitversion.outputs.buildMetaData }}"
echo "BuildMetaDataPadded: ${{ steps.gitversion.outputs.buildMetaDataPadded }}"
echo "FullBuildMetaData: ${{ steps.gitversion.outputs.fullBuildMetaData }}"
echo "MajorMinorPatch: ${{ steps.gitversion.outputs.majorMinorPatch }}"
echo "SemVer: ${{ steps.gitversion.outputs.semVer }}"
echo "LegacySemVer: ${{ steps.gitversion.outputs.legacySemVer }}"
echo "LegacySemVerPadded: ${{ steps.gitversion.outputs.legacySemVerPadded }}"
echo "AssemblySemVer: ${{ steps.gitversion.outputs.assemblySemVer }}"
echo "AssemblySemFileVer: ${{ steps.gitversion.outputs.assemblySemFileVer }}"
echo "FullSemVer: ${{ steps.gitversion.outputs.fullSemVer }}"
echo "InformationalVersion: ${{ steps.gitversion.outputs.informationalVersion }}"
echo "BranchName: ${{ steps.gitversion.outputs.branchName }}"
echo "EscapedBranchName: ${{ steps.gitversion.outputs.escapedBranchName }}"
echo "Sha: ${{ steps.gitversion.outputs.sha }}"
echo "ShortSha: ${{ steps.gitversion.outputs.shortSha }}"
echo "NuGetVersionV2: ${{ steps.gitversion.outputs.nuGetVersionV2 }}"
echo "NuGetVersion: ${{ steps.gitversion.outputs.nuGetVersion }}"
echo "NuGetPreReleaseTagV2: ${{ steps.gitversion.outputs.nuGetPreReleaseTagV2 }}"
echo "NuGetPreReleaseTag: ${{ steps.gitversion.outputs.nuGetPreReleaseTag }}"
echo "VersionSourceSha: ${{ steps.gitversion.outputs.versionSourceSha }}"
echo "CommitsSinceVersionSource: ${{ steps.gitversion.outputs.commitsSinceVersionSource }}"
echo "CommitsSinceVersionSourcePadded: ${{ steps.gitversion.outputs.commitsSinceVersionSourcePadded }}"
echo "UncommittedChanges: ${{ steps.gitversion.outputs.uncommittedChanges }}"
echo "CommitDate: ${{ steps.gitversion.outputs.commitDate }}"
outputs:
fullSemVer: ${{ steps.gitversion.outputs.fullSemVer}}

create-release:
name: Create Release
runs-on: ubuntu-22.04
needs: [GitVersion]
steps:
- uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.GitVersion.outputs.fullSemVer }}
release_name: Release ${{ needs.GitVersion.outputs.fullSemVer }}
draft: false
prerelease: false

image-promotion-release:
name: Tag images with Release Version
needs: [create-release]
runs-on: ubuntu-22.04
strategy:
matrix:
component: [backend/vehicles, backend/dops, frontend]
steps:
- uses: shrink/actions-docker-registry-tag@v3
with:
registry: ghcr.io
repository: ${{ github.repository }}/${{ matrix.component }}
target: test
tags: ${{ needs.GitVersion.outputs.fullSemVer }}

deploys-prod:
name: Deploy images to prod
needs: [image-promotion-release]
uses: ./.github/workflows/deploy.yml
with:
environment: 'prod'
imagetag: 'test'
vault_zone: 'prod'
zone: 'prod'
secrets: inherit

image-promotion-prod:
name: Tag images with Prod Version
needs: [deploys-prod]
runs-on: ubuntu-22.04
strategy:
matrix:
component: [backend/vehicles, backend/dops, frontend]
steps:
- uses: shrink/actions-docker-registry-tag@v3
with:
registry: ghcr.io
repository: ${{ github.repository }}/${{ matrix.component }}
target: test
tags: prod
1 change: 1 addition & 0 deletions .github/workflows/pr-close.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
# Remove old build runs, build pods and deployment pods
oc delete all,pvc,secret,configmap -l app=${{ github.event.repository.name }}-${{ github.event.number }}
- name: Authenticate and set context
uses: redhat-actions/oc-login@v1
with:
Expand Down
13 changes: 2 additions & 11 deletions .github/workflows/pr-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,18 @@ jobs:
strategy:
matrix:
package: [backend/vehicles, backend/dops, frontend]
include:
- package: backend/vehicles
triggers: ('backend/vehicles/')
- package: backend/dops
triggers: ('backend/dops/')
- package: frontend
triggers: ('frontend/')
steps:
- uses: actions/checkout@v4

- uses: bcgov-nr/[email protected]
with:
package: ${{ matrix.package }}
tag: ${{ github.event.number }}
tag_fallback: test
token: ${{ secrets.GITHUB_TOKEN }}
triggers: ${{ matrix.triggers }}
triggers: ( '${{ matrix.package }}/')

deploys:
needs:
- builds
needs: [builds]
uses: ./.github/workflows/deploy.yml
with:
environment: 'dev'
Expand Down

0 comments on commit 5822e74

Please sign in to comment.