Skip to content

🚀Production Release #87

🚀Production Release

🚀Production Release #87

Workflow file for this run

name: 🚀Production Release
run-name: 🚀Production Release ${{ inputs.dry-run == true && '(Dry Run)' || '' }}
defaults:
run:
shell: pwsh
on:
# NOTE: Do not delete this trigger. This is used by the Velaptor release system
workflow_dispatch:
inputs:
dry-run:
description: Dry Run - Check to run the workflow without creating a release.
required: false
default: false
type: boolean
jobs:
validate_branch:
name: Validate Branch
runs-on: ubuntu-latest
steps:
- name: Run Validation
run: |
$branch = "${{ github.ref }}";
$isNotDryRun = "${{ inputs.dry-run }}" -ne "true";
# If the branch is a dry run, allow the workflow on any branch
if ($isNotDryRun -and $branch -ne "refs/heads/${{ vars.RELEASE_BRANCH }}") {
Write-Host "::error::This workflow can only be run on the '${{ vars.RELEASE_BRANCH }}' branch.";
exit 1;
}
build_tutorial_solution:
name: Build Tutorial Solution
needs: validate_branch
uses: ./.github/workflows/build-csharp-solution.yml
with:
build-config: Release
perform_prod_release:
name: Perform Production Release
needs: [validate_branch, build_tutorial_solution]
runs-on: ubuntu-latest
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
token: ${{ secrets.CICD_TOKEN }}
persist-credentials: true
- name: Set Up Deno (${{ vars.DENO_VERSION }})
uses: denoland/setup-deno@v1
with:
deno-version: ${{ vars.DENO_VERSION }}
# This sdk version SHOULD be the same as the version set in the Velaptor project
- name: Setup dotnet (${{ vars.VELAPTOR_DOTNET_SDK_VERSION }})
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ vars.VELAPTOR_DOTNET_SDK_VERSION }}
- name: Setup Node (${{ vars.NODE_VERSION }})
uses: actions/setup-node@v4
with:
node-version: ${{ vars.NODE_VERSION }}
- name: Setup PNPM (${{ vars.PNPM_VERSION }})
uses: pnpm/action-setup@v2
with:
version: ${{ vars.PNPM_VERSION }}
- name: Install Dependencies (pnpm)
run: pnpm install;
- name: Update Website Version
id: apply_version_to_site
run: |
# Get the path to the output file created by the GitHub hosted runner
$outputFilePath = $env:GITHUB_OUTPUT;
if ($outputFilePath -eq "") {
Write-Host "::error::Failed to get output file path from the 'GITHUB_OUTPUT' environment variable.";
exit 1;
}
# NOTE: The script executed below sets the step output. This is why the output file
# path is passed in as an argument using the '$outputFilePath' variable.
deno run `
--allow-read `
--allow-write `
--allow-env `
"${{ github.workspace }}/.github/cicd/scripts/update-website-version.ts" `
"$outputFilePath";
- name: Build Site
run: pnpm build
- name: Setup Pages
if: ${{ inputs.dry-run == false }}
uses: actions/configure-pages@v5
- name: Upload Artifact
if: ${{ inputs.dry-run == false }}
uses: actions/upload-pages-artifact@v3.0.1
with:
path: "${{ github.workspace }}/${{ vars.RELATIVE_ARTIFACT_DIR_PATH }}"
- name: Deploy to GitHub Pages
id: deployment
if: ${{ inputs.dry-run == false }}
uses: actions/deploy-pages@v4
- name: Create Release Tag (${{ steps.apply_version_to_site.outputs.version }})
if: ${{ inputs.dry-run == false }}
run: |
$tag = "${{ steps.apply_version_to_site.outputs.version }}";
git config --global user.email "${{ vars.GIT_CONFIG_EMAIL }}";
git config --global user.name "Velaptor Docs Github Actions - (On behalf of Calvin Wilkinson)";
git commit --allow-empty -m "🚀Production Release";
git push;
git tag -a $tag -m "Production Release";
git push origin $tag;