Fix up PR Body from " and give PR creation for helm release a better … #92
Workflow file for this run
This file contains hidden or 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: Version-Checker Release | |
| on: | |
| push: | |
| branches: | |
| - "release-v*" | |
| tags: | |
| - "v*" | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| release-name: | |
| name: Generate a clean release name from the branch/tag | |
| runs-on: ubuntu-latest | |
| outputs: | |
| name: ${{ steps.release_number.outputs.substring }} | |
| steps: | |
| - uses: bhowell2/github-substring-action@1.0.2 | |
| id: release_number | |
| with: | |
| value: ${{github.ref_name}} | |
| index_of_str: "release-" | |
| prepare-release: | |
| # Don't push back to a tag! | |
| if: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
| needs: | |
| - release-name | |
| name: Prepare release | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: write | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Golang | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Find and Replace Helm Chart Version | |
| uses: jacobtomlinson/gha-find-replace@v3 | |
| with: | |
| find: 'v(\d+)\.(\d+)\.(\d+)(-rc(\d)+)?' | |
| replace: "${{needs.release-name.outputs.name}}" | |
| include: "deploy/charts/version-checker/Chart.yaml" | |
| regex: true | |
| - name: Find and Replace Kubernetes Manifests | |
| uses: jacobtomlinson/gha-find-replace@v3 | |
| with: | |
| find: 'v(\d+)\.(\d+)\.(\d+)(-rc(\d)+)?' | |
| replace: "${{needs.release-name.outputs.name}}" | |
| include: "deploy/yaml/deploy.yaml" | |
| regex: true | |
| - name: Find and Replace Makefile versions | |
| uses: jacobtomlinson/gha-find-replace@v3 | |
| with: | |
| find: 'v(\d+)\.(\d+)\.(\d+)(-rc(\d)+)?' | |
| replace: "${{needs.release-name.outputs.name}}" | |
| include: "Makefile" | |
| regex: true | |
| - name: Install Helm Docs | |
| uses: envoy/install-helm-docs@v1.0.0 | |
| with: | |
| version: 1.14.2 | |
| - name: Update Helm Docs | |
| run: | | |
| set -ex | |
| cd deploy/charts/version-checker | |
| helm-docs | |
| - name: Detect any Local Changes | |
| uses: dorny/paths-filter@v3 | |
| id: filter | |
| with: | |
| base: HEAD | |
| filters: | | |
| versions: | |
| - 'Makefile' | |
| - 'deploy/yaml/deploy.yaml' | |
| - 'deploy/charts/version-checker/Chart.yaml' | |
| - 'deploy/charts/version-checker/README.md' | |
| - name: Commit files | |
| if: steps.filter.outputs.versions == 'true' | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git status | |
| git commit -a -m "Bump versions to ${{needs.release-name.outputs.name}}" | |
| - name: Push changes | |
| if: steps.filter.outputs.versions == 'true' | |
| uses: ad-m/github-push-action@v0.8.0 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: ${{ github.ref_name }} | |
| - name: Build Changelog | |
| id: github_release | |
| uses: mikepenz/release-changelog-builder-action@v5 | |
| - name: Create Release PR | |
| uses: devops-infra/action-pull-request@v0.6.0 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| target_branch: main | |
| title: "Release ${{needs.release-name.outputs.name}}" | |
| body: |- | |
| **Automated Release Pull Request** | |
| ## Change log: | |
| ${{steps.github_release.outputs.changelog}} | |
| draft: false | |
| get_diff: false | |
| allow_no_diff: false | |
| helm-release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| needs: | |
| - release-name | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
| with: | |
| path: version-checker | |
| - name: Setup Cosign | |
| uses: sigstore/cosign-installer@main | |
| - name: checkout jetstack-charts | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.JETSTACK_CHARTS_PAT }} | |
| repository: jetstack/jetstack-charts | |
| ref: main | |
| path: jetstack-charts | |
| - name: Setup Helm | |
| uses: azure/setup-helm@v4 | |
| - name: Login to Quay.io | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: echo "${{ secrets.QUAY_ROBOT_TOKEN }}" | helm registry login quay.io -u ${{ secrets.QUAY_USERNAME }} --password-stdin | |
| - name: package helm chart | |
| run: | | |
| helm package version-checker/deploy/charts/version-checker -d jetstack-charts/charts/ | |
| - name: Sign Helm Chart | |
| run: | | |
| cosign sign-blob -y jetstack-charts/charts/version-checker-${{ needs.release-name.outputs.name }}.tgz \ | |
| --bundle jetstack-charts/charts/version-checker-${{ needs.release-name.outputs.name }}.tgz.cosign.bundle | |
| - name: Creating Publishing Chart's PR | |
| uses: peter-evans/create-pull-request@v7 | |
| if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
| with: | |
| token: ${{ secrets.JETSTACK_CHARTS_PAT }} | |
| title: "Release version-checker ${{ needs.release-name.outputs.name }}" | |
| commit-message: "Release version-checker ${{ needs.release-name.outputs.name }}" | |
| branch: version-checker/${{ github.ref_name }} | |
| path: jetstack-charts | |
| add-paths: | | |
| charts/*.tgz | |
| charts/*.tgz.cosign.bundle | |
| delete-branch: true | |
| signoff: true | |
| base: main | |
| - name: Push to Quay | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: |- | |
| helm push jetstack-charts/charts/version-checker-${{ needs.release-name.outputs.name }}.tgz oci://quay.io/quay.io/jetstack/version-checker/chart:${{needs.release-name.outputs.name}} | |
| docker-release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| needs: | |
| - release-name | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
| # Install the cosign tool except on PR | |
| # https://github.com/sigstore/cosign-installer | |
| - name: Install cosign | |
| uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0 | |
| with: | |
| cosign-release: "v2.2.4" | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| with: | |
| platforms: linux/amd64,linux/arm64 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: quay.io | |
| username: ${{ secrets.QUAY_USERNAME }} | |
| password: ${{ secrets.QUAY_ROBOT_TOKEN }} | |
| - name: Build and push (if applicable) | |
| id: build-and-push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| push: ${{ startsWith(github.ref, 'refs/tags/') }} | |
| pull: true | |
| tags: quay.io/jetstack/version-checker:${{github.ref_name}} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| attests: |- | |
| type=sbom | |
| type=provenance,mode=max | |
| # Sign the resulting Docker image digest except on PRs. | |
| # This will only write to the public Rekor transparency log when the Docker | |
| # repository is public to avoid leaking data. If you would like to publish | |
| # transparency data even for private images, pass --force to cosign below. | |
| # https://github.com/sigstore/cosign | |
| - name: Sign the published Docker image | |
| if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
| env: | |
| # https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable | |
| TAGS: ${{ steps.meta.outputs.tags }} | |
| DIGEST: ${{ steps.build-and-push.outputs.digest }} | |
| # This step uses the identity token to provision an ephemeral certificate | |
| # against the sigstore community Fulcio instance. | |
| run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST} | |
| github-release: | |
| name: Create/Update GitHub Release | |
| permissions: | |
| contents: write | |
| runs-on: ubuntu-latest | |
| needs: | |
| - release-name | |
| steps: | |
| - name: Create Release / Change Logs | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| draft: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
| prerelease: ${{ contains('-rc', github.ref_name) || !startsWith(github.ref, 'refs/tags/') }} | |
| generate_release_notes: true |