Closed snuggie12 closed 11 months ago
I confirmed that this approach is feasible. Here is the step and job after release-please in which I decide which of the 5 helm charts to publish. The include
part of the matrix is very important though I can't say I understand it. A slight modification to my above proposal is that it turns out it's an array of objects instead of nested like I propose:
- id: make-release-output
run: |
p1='{"release_created":${{ steps.release.outputs.argocd-apps--release_created }},"tag_name":"${{ steps.release.outputs.argocd-apps--tag_name }}"}'
p2='{"release_created":${{ steps.release.outputs.cloudsql--release_created }},"tag_name":"${{ steps.release.outputs.cloudsql--tag_name }}"}'
p3='{"release_created":${{ steps.release.outputs.k6--release_created }},"tag_name":"${{ steps.release.outputs.k6--tag_name }}"}'
p4='{"release_created":${{ steps.release.outputs.ml-postgres-exporter--release_created }},"tag_name":"${{ steps.release.outputs.ml-postgres-exporter--tag_name }}"}'
p5='{"release_created":${{ steps.release.outputs.ml-service--release_created }},"tag_name":"${{ steps.release.outputs.ml-service--tag_name }}"}'
echo "releases={\"include\":[${p1},${p2},${p3},${p4},${p5}]}" >> "$GITHUB_OUTPUT"
outputs:
release_created: ${{ steps.release.outputs.releases_created }}
releases: ${{ steps.make-release-output.outputs.releases }}
publish:
if: ${{ needs.release.outputs.release_created }}
needs:
- release
runs-on: self-hosted
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.release.outputs.releases) }}
container:
image: "REDACTED/automation/helm-publisher:latest"
credentials:
username: ${{ secrets.ARTIFACTORY_USERNAME }}
password: ${{ secrets.ARTIFACTORY_PASSWORD }}
steps:
- uses: actions/checkout@v3
- id: publish
if: ${{ matrix.release_created }}
run: |
VERSION=$(echo "${{ matrix.tag_name }}" | sed 's:.*-v::');
CHART_NAME=$(echo "${{ matrix.tag_name }}" | sed 's/-[^-]*$//');
./helm-publish.sh "$CHART_NAME" "$VERSION"
Similar to what you have above, you should be able to take the paths_released
output, use fromJson(needs.release.outputs.paths_released)
as the matrix. Then build the output from <path>--tag_name
https://github.com/google-github-actions/release-please-action#path-outputs
TL;DR
This is more of a question but possibly a feature request. If using
manifest
andpaths_released
, how are you supposed to get the tag name? In the tests (such as your own test you explicitly lista
andb
but don't usepaths_released
to figure that out,) or any examples I've seen around the path is known. However we have 5 different paths that could be there so I'm unsure how to make a job output from the release-please step. Or is it that all 5 are added to the outputs manually and I'm supposed to use anif
condition to check thatfoo--release_created
istrue
?If there isn't a really good answer would it be possible to make an object instead like:
Detailed design
No response
Additional information
No response