fix: also set release notes from file when file exists #2912
Workflow file for this run
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: Components | |
on: | |
pull_request: | |
workflow_call: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: read | |
pull-requests: read | |
env: | |
CTF_TYPE: directory | |
components: '["ocmcli", "helminstaller", "helmdemo", "subchartsdemo", "ecrplugin"]' | |
jobs: | |
define-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
components: ${{ steps.componentMatrix.outputs.matrix }} | |
steps: | |
- id: componentMatrix | |
name: Set Components to be used for Build | |
run: | | |
echo "matrix=$input" >> $GITHUB_OUTPUT | |
env: | |
input: ${{ env.components }} | |
build: | |
name: "Build" | |
needs: define-matrix | |
strategy: | |
matrix: | |
component: ${{fromJSON(needs.define-matrix.outputs.components)}} | |
runs-on: large_runner | |
steps: | |
- name: Self Hosted Runner Post Job Cleanup Action | |
uses: TooMuch4U/[email protected] | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: '${{ github.workspace }}/go.mod' | |
cache: false | |
- name: Get go environment for use with cache | |
run: | | |
echo "go_cache=$(go env GOCACHE)" >> $GITHUB_ENV | |
echo "go_modcache=$(go env GOMODCACHE)" >> $GITHUB_ENV | |
# This step will only reuse the go mod and build cache from main made during the Build, | |
# see push_ocm.yaml => "ocm-cli-latest" Job | |
# This means it never caches by itself and PRs cannot cause cache pollution / thrashing | |
# This is because we have huge storage requirements for our cache because of the mass of dependencies | |
- name: Restore / Reuse Cache from central build | |
id: cache-golang-restore | |
uses: actions/cache/restore@v4 # Only Restore, not build another cache (too big) | |
with: | |
path: | | |
${{ env.go_cache }} | |
${{ env.go_modcache }} | |
key: ${{ env.cache_name }}-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}-${{ hashFiles('**/go.mod') }} | |
restore-keys: | | |
${{ env.cache_name }}-${{ runner.os }}-go- | |
env: | |
cache_name: ocm-cli-latest-go-cache # needs to be the same key in the end as in the build step | |
- name: CTF | |
run: | | |
cd components/${{ matrix.component }} | |
PATH=$PATH:$(go env GOPATH)/bin CTF_TYPE=${{ env.CTF_TYPE }} make ctf descriptor describe | |
- name: Upload CTF | |
uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: error | |
overwrite: true | |
retention-days: 1 | |
name: ctf-component-${{ matrix.component }} | |
path: gen/${{ matrix.component }}/ctf | |
aggregate: | |
name: "Aggregate" | |
runs-on: large_runner | |
needs: [build, define-matrix] | |
env: | |
components: ${{ join(fromJSON(needs.define-matrix.outputs.components), ' ') }} | |
steps: | |
- name: Self Hosted Runner Post Job Cleanup Action | |
uses: TooMuch4U/[email protected] | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download CTFs | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: 'ctf-component-*' | |
path: gen/downloaded-ctfs | |
- name: Move CTFs into correct directory for aggregation | |
run: | | |
IFS=" " read -a COMPONENTS <<< "${{ env.components }}" | |
for i in "${COMPONENTS[@]}"; do | |
mkdir -p ${{ github.workspace }}/gen/${i} | |
mv ${{ github.workspace }}/gen/downloaded-ctfs/ctf-component-${i} ${{ github.workspace }}/gen/${i}/ctf | |
ls -R ${{ github.workspace }}/gen/${i} | |
done | |
- name: Extract OCM Binary from CTF to avoid OCM Inception | |
id: extract-ocm | |
run: | | |
ocm_binary=$(bash ./hack/get_bare_resource_from_ctf.sh \ | |
"ocm.software/ocmcli" \ | |
"" \ | |
"ocmcli" \ | |
$(go env GOARCH) \ | |
$(go env GOOS) \ | |
"application/octet-stream" \ | |
${{ github.workspace }}/gen/ocmcli/ctf) | |
new_loc=${{ github.workspace }}/bin/ocm | |
mkdir -p $(dirname $new_loc) | |
ln -s $ocm_binary $new_loc | |
chmod +x $new_loc | |
echo "OCM binary linked to $new_loc" | |
echo "binary=$new_loc" >> $GITHUB_OUTPUT | |
- name: Create aggregated CTF | |
run: | | |
for i in ${{ env.components }}; do | |
echo "transfering component $i..." | |
${{ steps.extract-ocm.outputs.binary }} transfer cv \ | |
--type ${{ env.CTF_TYPE }} -V \ | |
${{ github.workspace }}/gen/$i/ctf \ | |
${{ github.workspace }}/gen/ctf | |
done | |
- name: Upload aggregated CTF | |
# TODO This is currently permanently disabled, | |
# until we integrate it with the release build, in which it would be reused | |
if: false | |
uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: error | |
overwrite: true | |
retention-days: 60 | |
name: ctf-aggregated | |
path: gen/ctf | |
- name: Delete old CTFs that lead up to aggregation | |
uses: geekyeggo/delete-artifact@v5 | |
with: | |
name: | | |
ctf-component-* |