Skip to content
Open
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
8 changes: 4 additions & 4 deletions .github/workflows/job-release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ on:
workflow_call:

outputs:

release-created:
description: Has a new release been created ?
value: ${{ jobs.prepare.outputs.releases-created && !contains(jobs.prepare.outputs.tag-name, 'rc') }}
Expand Down Expand Up @@ -57,12 +56,11 @@ jobs:
# This job handles (thus the `prepare` name) a prerelease/release MR,
# and provides the necessary outputs for the two subsequent jobs.
# It will either:
# - Upsert a prerelease MR after a commit has been added to the target branch (namely, `main`)
# - Upsert a prerelease MR after a commit has been added to the target branch (`releases`)
# - Create a prerelease (`X.Y.Z-rc`, `X.Y.Z-rc.1`, `X.Y.Z-rc.2`, etc.), if this workflow has been triggered by the related MR merge
# - Create a release (`X.Y.Z`), if this workflow has been triggered by the related MR merge
# - In both cases "Create" means:
# - Updating the CHANGLOG accordingly (with the related commits)
# - Updating the apps package.json versions
# - Updating the release manifest and application package.json versions
# - Generating and push the git tag
# - Creating the related GitHub Release
prepare:
Expand All @@ -82,6 +80,7 @@ jobs:
with:
config-file: ".github/prerelease-please-config.json"
manifest-file: ".github/prerelease-please-manifest.json"
target-branch: releases

# This job only runs when a prerelease has just been created and thus,
# will create/updade a subsequent "stable" release MR with the changelog incorporating the prereleases
Expand All @@ -100,6 +99,7 @@ jobs:
with:
config-file: .github/release-please-config.json
manifest-file: .github/release-please-manifest.json
target-branch: releases
token: ${{ secrets.GITHUB_TOKEN }}

# This job only runs when a release has just been created and thus,
Expand Down
71 changes: 7 additions & 64 deletions .github/workflows/workflow-handle-main.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
name: Handle next prerelease or release
name: Build and deploy latest from main

permissions:
# Needed for release job
issues: write
contents: write
pull-requests: write
# Needed for build job
contents: read
packages: write

on:
Expand All @@ -17,7 +13,6 @@ env:
REGISTRY: ghcr.io
NAMESPACE: "${{ github.repository }}"
BUILD_AMD64: true
BUILD_ARM64: true
USE_QEMU: false
NODE_VERSION: 26.7.0

Expand All @@ -28,78 +23,26 @@ jobs:
REGISTRY: ${{ env.REGISTRY }}
NAMESPACE: ${{ env.NAMESPACE }}
BUILD_AMD64: ${{ env.BUILD_AMD64 }}
BUILD_ARM64: ${{ env.BUILD_ARM64 }}
USE_QEMU: ${{ env.USE_QEMU }}
NODE_VERSION: ${{ env.NODE_VERSION }}
steps:
- name: Exposing env vars
run: echo "Exposing env vars"

release:
uses: ./.github/workflows/job-release-please.yml

build-amd64:
uses: ./.github/workflows/job-build.yml
# We build:
# - Whenever we push a commit on `main` branch, for CI purposes (we automatically push the build on our `cpin-hp` env)
# - Whenever we issue a new release, prerelease (both done on `main`)
if: ${{ github.ref == format('refs/heads/{0}', 'main') }}
needs:
- expose-vars
- release
with:
REGISTRY: ${{ needs.expose-vars.outputs.REGISTRY }}
NAMESPACE: ${{ needs.expose-vars.outputs.NAMESPACE }}
RELEASE_CREATED: ${{ needs.release.outputs.release-created == 'true' }}
TAG: ${{ needs.release.outputs.tag-name }}
MAJOR_TAG: ${{ needs.release.outputs.major-tag }}
MINOR_TAG: ${{ needs.release.outputs.minor-tag }}
PATCH_TAG: ${{ needs.release.outputs.patch-tag }}
RELEASE_CREATED: false
TAG: ''
MAJOR_TAG: ''
MINOR_TAG: ''
PATCH_TAG: ''
BUILD_AMD64: ${{ needs.expose-vars.outputs.BUILD_AMD64 == 'true' }}
BUILD_ARM64: false
USE_QEMU: ${{ needs.expose-vars.outputs.USE_QEMU == 'true' }}
secrets:
ARGOCD_TOKEN: ${{ secrets.ARGOCD_TOKEN }}

build-arm64:
uses: ./.github/workflows/job-build.yml
if: ${{ needs.release.outputs.release-created == 'true' || needs.release.outputs.prerelease-created == 'true' }}
needs:
- expose-vars
- release
with:
REGISTRY: ${{ needs.expose-vars.outputs.REGISTRY }}
NAMESPACE: ${{ needs.expose-vars.outputs.NAMESPACE }}
RELEASE_CREATED: ${{ needs.release.outputs.release-created == 'true' }}
TAG: ${{ needs.release.outputs.tag-name }}
MAJOR_TAG: ${{ needs.release.outputs.major-tag }}
MINOR_TAG: ${{ needs.release.outputs.minor-tag }}
PATCH_TAG: ${{ needs.release.outputs.patch-tag }}
BUILD_AMD64: false
BUILD_ARM64: ${{ needs.expose-vars.outputs.BUILD_ARM64 == 'true' }}
USE_QEMU: ${{ needs.expose-vars.outputs.USE_QEMU == 'true' }}
secrets:
ARGOCD_TOKEN: ${{ secrets.ARGOCD_TOKEN }}

update-chart:
runs-on: ubuntu-latest
if: ${{ needs.release.outputs.tag-name != '' }}
needs:
- expose-vars
- release
- build-amd64
steps:
- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0
with:
app-id: ${{ secrets.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
repositories: helm-charts

- name: Trigger helm-charts update
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
gh workflow --repo cloud-pi-native/helm-charts run update-chart.yaml -f APP_VERSION=${{ needs.release.outputs.tag-name }} -f CHART_NAME=dso-console
100 changes: 100 additions & 0 deletions .github/workflows/workflow-handle-releases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Handle next prerelease or release

permissions:
issues: write
contents: write
pull-requests: write
packages: write

on:
push:
branches:
- releases

env:
REGISTRY: ghcr.io
NAMESPACE: "${{ github.repository }}"
BUILD_AMD64: true
BUILD_ARM64: true
USE_QEMU: false
NODE_VERSION: 26.7.0

jobs:
expose-vars:
runs-on: ubuntu-latest
outputs:
REGISTRY: ${{ env.REGISTRY }}
NAMESPACE: ${{ env.NAMESPACE }}
BUILD_AMD64: ${{ env.BUILD_AMD64 }}
BUILD_ARM64: ${{ env.BUILD_ARM64 }}
USE_QEMU: ${{ env.USE_QEMU }}
NODE_VERSION: ${{ env.NODE_VERSION }}
steps:
- name: Exposing env vars
run: echo "Exposing env vars"

release:
uses: ./.github/workflows/job-release-please.yml

build-amd64:
uses: ./.github/workflows/job-build.yml
if: ${{ needs.release.outputs.release-created == 'true' || needs.release.outputs.prerelease-created == 'true' }}
needs:
- expose-vars
- release
with:
REGISTRY: ${{ needs.expose-vars.outputs.REGISTRY }}
NAMESPACE: ${{ needs.expose-vars.outputs.NAMESPACE }}
RELEASE_CREATED: ${{ needs.release.outputs.release-created == 'true' }}
TAG: ${{ needs.release.outputs.tag-name }}
MAJOR_TAG: ${{ needs.release.outputs.major-tag }}
MINOR_TAG: ${{ needs.release.outputs.minor-tag }}
PATCH_TAG: ${{ needs.release.outputs.patch-tag }}
BUILD_AMD64: ${{ needs.expose-vars.outputs.BUILD_AMD64 == 'true' }}
BUILD_ARM64: false
USE_QEMU: ${{ needs.expose-vars.outputs.USE_QEMU == 'true' }}
secrets:
ARGOCD_TOKEN: ${{ secrets.ARGOCD_TOKEN }}

build-arm64:
uses: ./.github/workflows/job-build.yml
if: ${{ needs.release.outputs.release-created == 'true' || needs.release.outputs.prerelease-created == 'true' }}
needs:
- expose-vars
- release
with:
REGISTRY: ${{ needs.expose-vars.outputs.REGISTRY }}
NAMESPACE: ${{ needs.expose-vars.outputs.NAMESPACE }}
RELEASE_CREATED: ${{ needs.release.outputs.release-created == 'true' }}
TAG: ${{ needs.release.outputs.tag-name }}
MAJOR_TAG: ${{ needs.release.outputs.major-tag }}
MINOR_TAG: ${{ needs.release.outputs.minor-tag }}
PATCH_TAG: ${{ needs.release.outputs.patch-tag }}
BUILD_AMD64: false
BUILD_ARM64: ${{ needs.expose-vars.outputs.BUILD_ARM64 == 'true' }}
USE_QEMU: ${{ needs.expose-vars.outputs.USE_QEMU == 'true' }}
secrets:
ARGOCD_TOKEN: ${{ secrets.ARGOCD_TOKEN }}

update-chart:
runs-on: ubuntu-latest
if: ${{ needs.release.outputs.tag-name != '' }}
needs:
- expose-vars
- release
- build-amd64
steps:
- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0
with:
app-id: ${{ secrets.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
repositories: helm-charts

- name: Trigger helm-charts update
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
gh workflow --repo cloud-pi-native/helm-charts run update-chart.yaml -f APP_VERSION=${{ needs.release.outputs.tag-name }} -f CHART_NAME=dso-console
Loading
Loading