build is being published #17
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: publish | |
run-name: build is being published | |
on: | |
workflow_run: | |
workflows: | |
- build | |
types: | |
- completed | |
permissions: | |
contents: read | |
id-token: write | |
jobs: | |
publish-first: | |
runs-on: ubuntu-24.04 | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
steps: | |
- name: Get image tag | |
id: tag | |
run: | | |
tag=${{ github.event.workflow_run.head_branch }} | |
echo tag=$tag >> $GITHUB_OUTPUT | |
- name: check out code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ steps.tag.outputs.tag }} | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: makefile-digests-${{ github.sha }} | |
run-id: ${{ github.event.workflow_run.id }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Login to registry | |
shell: bash | |
run: | | |
helm registry login registry-1.docker.io -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | |
- name: Push Helm chart | |
id: push | |
shell: bash | |
run: | | |
version="${{ steps.tag.outputs.tag }}" | |
ersion="${version#v}" | |
echo "version is ${version}, ersion is ${ersion}" | |
helm package test-chart --dependency-update --version "${ersion}" | |
helm push test-chart-*.tgz "oci://registry-1.docker.io/fad3t" &> metadata.txt | |
digest=$(awk '/Digest: /{print $2}' metadata.txt) | |
echo "digest=${digest}" >> $GITHUB_OUTPUT | |
- name: Install Cosign | |
uses: sigstore/cosign-installer@4959ce089c160fddf62f7b42464195ba1a56d382 # v3.6.0 | |
- name: Sign Container Image | |
run: | | |
cosign sign -y registry-1.docker.io/fad3t/test-chart@${{ steps.push.outputs.digest }} |