ci: fix: appears i must infact use global (#902) #227
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: Merge | |
on: | |
push: | |
branches: [main] | |
paths-ignore: | |
- '*.md' | |
- '.github/**' | |
- 'common/graphics/**' | |
- '!.github/workflows/.deploy.yml' | |
- '!.github/workflows/merge.yml' | |
workflow_dispatch: | |
inputs: | |
pr_no: | |
description: "PR-numbered container set to deploy" | |
type: number | |
required: true | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
vars: | |
name: Set Variables | |
outputs: | |
pr: ${{ steps.pr.outputs.pr }} | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 1 | |
steps: | |
# Get PR number for squash merges to main | |
- name: PR Number | |
id: pr | |
uses: bcgov-nr/[email protected] | |
deploys-test: | |
name: Deploys (test) | |
needs: [vars] | |
uses: ./.github/workflows/.deploy.yml | |
secrets: inherit | |
with: | |
environment: test | |
release: test | |
tag: ${{ needs.vars.outputs.pr }} | |
vault_role: nonprod | |
vault_zone: test | |
promote-images-test: | |
name: Promote Images - Test | |
needs: [deploys-test, vars] | |
runs-on: ubuntu-22.04 | |
permissions: | |
packages: write | |
strategy: | |
matrix: | |
package: [dops, vehicles, frontend, tps-migration] | |
timeout-minutes: 2 | |
steps: | |
- uses: shrink/actions-docker-registry-tag@v3 | |
with: | |
registry: ghcr.io | |
repository: ${{ github.repository }}/${{ matrix.package }} | |
target: ${{ needs.vars.outputs.pr }} | |
tags: test #Promote images AFTER successful deploy | |
deploys-prod: | |
name: Deploys (prod) | |
needs: [promote-images-test, vars] | |
uses: ./.github/workflows/.deploy.yml | |
secrets: inherit | |
with: | |
environment: prod | |
tag: ${{ needs.vars.outputs.pr }} | |
release: prod | |
vault_role: prod | |
vault_zone: prod | |
promote-images-prod: | |
name: Promote Images - Prod | |
needs: [deploys-prod, vars] | |
runs-on: ubuntu-22.04 | |
permissions: | |
packages: write | |
strategy: | |
matrix: | |
package: [dops, vehicles, frontend, tps-migration] | |
timeout-minutes: 2 | |
steps: | |
- uses: shrink/actions-docker-registry-tag@v3 | |
with: | |
registry: ghcr.io | |
repository: ${{ github.repository }}/${{ matrix.package }} | |
target: ${{ needs.vars.outputs.pr }} | |
tags: prod #Promote images AFTER successful deploy | |
GitVersion: | |
name: Mainline Versioning - GitVersion | |
needs: | |
- promote-images-prod | |
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] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | |
steps: | |
- uses: actions/create-release@v1 | |
with: | |
tag_name: ${{ needs.GitVersion.outputs.fullSemVer }} | |
release_name: Release ${{ needs.GitVersion.outputs.fullSemVer }} | |
draft: false | |
prerelease: false | |
promote-images-release: | |
name: Tag images with Release Version | |
needs: [GitVersion, create-release, vars] | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
package: [dops, vehicles, frontend, tps-migration] | |
timeout-minutes: 2 | |
steps: | |
- uses: shrink/actions-docker-registry-tag@v3 | |
with: | |
registry: ghcr.io | |
repository: ${{ github.repository }}/${{ matrix.package }} | |
target: ${{ needs.vars.outputs.pr }} | |
tags: ${{ needs.GitVersion.outputs.fullSemVer }} |