Ignore pre-release's when generating changelogs #109
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.release_number.outputs.substring || github.ref_name }}" | |
| steps: | |
| - uses: bhowell2/[email protected] | |
| id: release_number | |
| continue-on-error: true | |
| 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/[email protected] | |
| 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: | | |
| set -x | |
| 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/[email protected] | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: ${{ github.ref_name }} | |
| - name: Build Changelog | |
| id: github_release | |
| uses: mikepenz/release-changelog-builder-action@v5 | |
| with: | |
| ignorePreReleases: true | |
| - name: Create Release PR | |
| uses: devops-infra/[email protected] | |
| 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 | |
| # FIXME: We need a Repo Created in Quay ahead of time for this to work | |
| # - name: Login to Quay.io for OCI Push | |
| # 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 | |
| # FIXME: We need a Repo Created in Quay ahead of time for this to work | |
| # - 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/jetstack/version-checker/chart | |
| - 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 | |
| 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@3454372f43399081ed03b604cb2d021dabca52bb #v3.8.2 | |
| 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 | |
| - name: Sign the published Docker image (if tag) | |
| 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: quay.io/jetstack/version-checker:${{github.ref_name}} | |
| DIGEST: ${{ steps.build-and-push.outputs.digest }} | |
| run: |- | |
| cosign sign --yes "quay.io/jetstack/version-checker:${{github.ref_name}}@${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 |