mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-04 00:47:04 +02:00
ci: More ci changes
This commit is contained in:
parent
c91cd7a050
commit
89be81f5b3
2 changed files with 101 additions and 14 deletions
61
.github/workflows/charts-release.yaml
vendored
61
.github/workflows/charts-release.yaml
vendored
|
@ -5,6 +5,12 @@ concurrency: helm-release
|
|||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
charts:
|
||||
description: "JSON encoded list of charts to release"
|
||||
required: true
|
||||
type: string
|
||||
default: "[]"
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
@ -17,8 +23,10 @@ jobs:
|
|||
runs-on: ubuntu-22.04
|
||||
outputs:
|
||||
repoConfiguration: ${{ steps.repo-config.outputs.config }}
|
||||
libraryChartsToRelease: ${{ steps.changed-library-charts.outputs.all_changed_files }}
|
||||
otherChartsToRelease: ${{ steps.changed-charts.outputs.all_changed_files }}
|
||||
libraryChartsToRelease: |-
|
||||
${{ github.event_name == 'workflow_dispatch' && steps.specified-charts.outputs.libraryChartsToRelease || steps.changed-library-charts.outputs.all_changed_files }}
|
||||
otherChartsToRelease: |-
|
||||
${{ github.event_name == 'workflow_dispatch' && steps.specified-charts.outputs.otherChartsToRelease || steps.changed-charts.outputs.all_changed_files }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
@ -33,6 +41,7 @@ jobs:
|
|||
|
||||
- name: Get changed library charts
|
||||
id: changed-library-charts
|
||||
if: ${{ github.event_name != 'workflow_dispatch' }}
|
||||
uses: tj-actions/changed-files@v45
|
||||
with:
|
||||
matrix: true
|
||||
|
@ -44,6 +53,7 @@ jobs:
|
|||
|
||||
- name: Get changed charts
|
||||
id: changed-charts
|
||||
if: ${{ github.event_name != 'workflow_dispatch' }}
|
||||
uses: tj-actions/changed-files@v45
|
||||
with:
|
||||
matrix: true
|
||||
|
@ -53,11 +63,49 @@ jobs:
|
|||
files_ignore: |
|
||||
library/**
|
||||
|
||||
- name: Get specified charts
|
||||
id: specified-charts
|
||||
if: ${{ github.event_name == 'workflow_dispatch' }}
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
let input = '${{ github.event.inputs.charts }}';
|
||||
let cwd = process.cwd();
|
||||
|
||||
let tmpCharts = []
|
||||
if (input === '[]') {
|
||||
console.log("Empty charts input, scanning for charts in repository");
|
||||
const globber = await glob.create('charts/*/*', { implicitDescendants: false });
|
||||
for await (const file of globber.globGenerator()) {
|
||||
relativePath = file.slice(`${cwd}/charts/`.length);
|
||||
tmpCharts.push(relativePath);
|
||||
}
|
||||
} else {
|
||||
const fs = require('fs');
|
||||
tmpCharts = JSON.parse(input);
|
||||
tmpCharts.forEach(function (chart) {
|
||||
if (!fs.existsSync(`${cwd}/charts/${chart}`)) {
|
||||
core.setFailed(`Chart ${chart} does not exist in repository`);
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
let libraryCharts = tmpCharts.filter(chart => chart.startsWith('library/'));
|
||||
let otherCharts = tmpCharts.filter(chart => !chart.startsWith('library/'));
|
||||
|
||||
console.log("Library charts:")
|
||||
console.log(JSON.stringify(libraryCharts));
|
||||
core.setOutput('libraryChartsToRelease', JSON.stringify(libraryCharts));
|
||||
console.log("Other charts:")
|
||||
console.log(JSON.stringify(otherCharts));
|
||||
core.setOutput('otherChartsToRelease', JSON.stringify(otherCharts));
|
||||
|
||||
release-library-charts:
|
||||
name: Release library charts
|
||||
needs:
|
||||
- prepare
|
||||
if: ${{ needs.prepare.outputs.libraryChartsToRelease != '[]' }}
|
||||
if: ${{ needs.prepare.outputs.libraryChartsToRelease != '[]' && needs.prepare.outputs.libraryChartsToRelease != '' }}
|
||||
uses: ./.github/workflows/charts-release-steps.yaml
|
||||
permissions:
|
||||
pages: write
|
||||
|
@ -75,10 +123,11 @@ jobs:
|
|||
needs:
|
||||
- prepare
|
||||
- release-library-charts
|
||||
if: |
|
||||
if: |-
|
||||
${{
|
||||
always() &&
|
||||
!failure() && !cancelled() &&
|
||||
!cancelled() &&
|
||||
(needs.prepare.result == 'skipped' || needs.prepare.result == 'success') &&
|
||||
(needs.release-library-charts.result == 'skipped' || needs.release-library-charts.result == 'success') &&
|
||||
needs.prepare.outputs.otherChartsToRelease != '[]'
|
||||
}}
|
||||
uses: ./.github/workflows/charts-release-steps.yaml
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue