Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/cicd-1-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,19 @@ jobs:
terraform_version: "${{ needs.metadata.outputs.terraform_version }}"
version: "${{ needs.metadata.outputs.version }}"
secrets: inherit
publish-stage: # Recommended maximum execution time is 10 minutes
name: "Publish stage"
needs: [metadata, build-stage]
uses: ./.github/workflows/stage-5-publish.yaml
if: (github.event_name == 'push' && github.ref == 'refs/heads/main')
with:
build_datetime: "${{ needs.metadata.outputs.build_datetime }}"
build_timestamp: "${{ needs.metadata.outputs.build_timestamp }}"
build_epoch: "${{ needs.metadata.outputs.build_epoch }}"
nodejs_version: "${{ needs.metadata.outputs.nodejs_version }}"
pnpm_version: "${{ needs.metadata.outputs.pnpm_version }}"
python_version: "${{ needs.metadata.outputs.python_version }}"
terraform_version: "${{ needs.metadata.outputs.terraform_version }}"
version: "${{ needs.metadata.outputs.version }}"
is_version_prerelease: "${{ needs.metadata.outputs.is_version_prerelease }}"
secrets: inherit
32 changes: 25 additions & 7 deletions .github/workflows/cicd-3-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,39 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}
run: |
if [[ ${{inputs.include_prereleases}} == true ]]; then
INPUTS_INCLUDE_PRERELEASES="${{ inputs.include_prereleases }}"
INPUTS_INCLUDE_PRERELEASES=${INPUTS_INCLUDE_PRERELEASES:-"true"}

INPUTS_VERSION="${{ inputs.version }}"
INPUTS_VERSION=${INPUTS_VERSION:-"latest"}


if [[ $INPUTS_INCLUDE_PRERELEASES == true ]]; then
json=$(gh release list --json tagName --limit 1 --exclude-drafts)
else
json=$(gh release list --json tagName --limit 1 --exclude-drafts --exclude-pre-releases)
fi

echo $json
echo "Release list response: $json"

# Check if the response is empty
if [[ "$json" == "[]" ]] || [[ -z "$json" ]]; then
echo "::error::No releases found. Please create a release before deploying docs."
exit 1
fi

release_version=$(echo $json | jq -r '.[0].tagName')
if [[ "$release_version" == "null" ]] || [[ -z "$release_version" ]]; then
echo "::error::Could not extract release version from: $json"
exit 1
fi

release_version=$(echo $json | (jq -r '.[0].tagName'))
if [[ $release_version == null ]]; then exit 1; else echo $release_version; fi
echo "Found release version: $release_version"

if [[ ${{inputs.version}} == latest ]]; then
echo release_version=$(echo $release_version) >> $GITHUB_OUTPUT
if [[ $INPUTS_VERSION == latest ]]; then
echo "release_version=$release_version" >> $GITHUB_OUTPUT
else
echo release_version=$(echo ${{inputs.version}}) >> $GITHUB_OUTPUT
echo "release_version=$INPUTS_VERSION" >> $GITHUB_OUTPUT
fi

- name: "Get release version"
Expand Down
87 changes: 87 additions & 0 deletions .github/workflows/stage-5-publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: "Publish stage"

on:
workflow_call:
inputs:
build_datetime:
description: "Build datetime, set by the CI/CD pipeline workflow"
required: true
type: string
build_timestamp:
description: "Build timestamp, set by the CI/CD pipeline workflow"
required: true
type: string
build_epoch:
description: "Build epoch, set by the CI/CD pipeline workflow"
required: true
type: string
nodejs_version:
description: "Node.js version, set by the CI/CD pipeline workflow"
required: true
type: string
pnpm_version:
description: "pnpm version, set by the CI/CD pipeline workflow"
required: true
type: string
python_version:
description: "Python version, set by the CI/CD pipeline workflow"
required: true
type: string
terraform_version:
description: "Terraform version, set by the CI/CD pipeline workflow"
required: true
type: string
version:
description: "Version of the software, set by the CI/CD pipeline workflow"
required: true
type: string
is_version_prerelease:
description: "Is this a semantically versioned pre release, set by the CI/CD pipeline workflow"
required: true
type: string
jobs:
publish:
name: "Publish packages"
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write
packages: write

steps:
- name: "Checkout code"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: "Get artifacts: jekyll docs"
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
path: ./artifacts/jekyll-docs-${{ inputs.version }}
name: jekyll-docs-${{ inputs.version }}

- name: Draft Release
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
gh release create \
"${{ inputs.version }}" \
--draft \
--latest \
--title "${{ inputs.version }}" \
--notes "Release of ${{ inputs.version }}" \
${{ inputs.is_version_prerelease == 'true' && '--prerelease' || '' }}

- name: "Upload jekyll docs release asset"
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
cp ./artifacts/jekyll-docs-${{ inputs.version }}/artifact.tar $RUNNER_TEMP/jekyll-docs-${{ inputs.version }}.tar
gh release upload \
"${{ inputs.version }}" \
$RUNNER_TEMP/jekyll-docs-${{ inputs.version }}.tar#jekyll-docs-${{ inputs.version }}

- name: Publish Release
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: gh release edit "${{ inputs.version }}" --draft=false
Loading