From 2eba326fd2bd7030f9fe167e388bea230b2b23ea Mon Sep 17 00:00:00 2001 From: Vince Prignano Date: Mon, 8 Apr 2024 08:43:35 -0700 Subject: [PATCH] Add github action to package envtest binaries in releases Signed-off-by: Vince Prignano --- .github/workflows/golangci-lint.yml | 2 +- .github/workflows/tools-releases.yml | 91 ++++++++++++++-------------- 2 files changed, 47 insertions(+), 46 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 7baade1aa..83193a5fc 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -4,6 +4,7 @@ on: types: [opened, edited, synchronize, reopened] branches: - main + - master permissions: # Required: allow read access to the content for analysis. @@ -21,7 +22,6 @@ jobs: matrix: working-directory: - "" - - tools/setup-envtest steps: - name: Set up Go uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # tag=v5.0.0 diff --git a/.github/workflows/tools-releases.yml b/.github/workflows/tools-releases.yml index 9b411698f..f086dbb3e 100644 --- a/.github/workflows/tools-releases.yml +++ b/.github/workflows/tools-releases.yml @@ -3,9 +3,10 @@ name: Package controller-runtime envtest on: push: branches: - - main + - main + - master paths: - - 'hack/envtest/_matrix/*.yaml' + - 'hack/envtest/_matrix/*.yaml' permissions: contents: write @@ -15,46 +16,46 @@ jobs: build-and-push: runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # tag=v4.1.2 - - name: Get changed files - id: changed-files - uses: tj-actions/changed-files@635f118699dd888d737c15018cd30aff2e0274f8 # tag=v44.0.1 - with: - files: | - hack/envtest/_matrix/*.yaml - - name: Setup package release version - id: release-version - run: | - if [[ ${{ steps.changed-files.outputs.all_changed_files_count }} != 1 ]]; then - echo "One Kubernetes patch version files should be changed for a release, found ${{ steps.changed-files.outputs.all_changed_files_count }}" - exit 1 - fi - - for changed_file in ${{ steps.changed-files.outputs.all_changed_files }}; do - export KUBERNETES_VERSION=$(echo "${changed_file}" | grep -oP '(?<=/)[^/]+(?=\.yaml)') - echo "KUBERNETES_VERSION=$KUBERNETES_VERSION" >> $GITHUB_ENV - done - - name: Build packages - run: | - make release-envtest KUBERNETES_VERSION=${{ env.KUBERNETES_VERSION }} - - name: Release - uses: softprops/action-gh-release@9d7c94cfd0a1f3ed45544c887983e9fa900f0564 # tag=v2.0.4 - with: - name: envtest-${{ env.KUBERNETES_VERSION }} - draft: true - make_latest: false - files: | - out/envtest-*.tar.gz - out/envtest-*.tar.gz.sha512 - fail_on_unmatched_files: true - - name: Create Pull Request - uses: peter-evans/create-pull-request@9153d834b60caba6d51c9b9510b087acf9f33f83 # tag=v6.0.4 - with: - commit-message: Promote envtest release for Kubernetes ${{ env.KUBERNETES_VERSION }} - title: ":seedling: Promotion of envtest release for Kubernetes ${{ env.KUBERNETES_VERSION }}" - body: | - This PR promotes the envtest release for Kubernetes ${{ env.KUBERNETES_VERSION }}. - branch: promote-envtest-${{ env.KUBERNETES_VERSION }} - add-paths: | - envtest-releases.yaml + - name: Checkout code + uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # tag=v4.1.2 + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@635f118699dd888d737c15018cd30aff2e0274f8 # tag=v44.0.1 + with: + files: | + hack/envtest/_matrix/*.yaml + - name: Setup package release version + id: release-version + run: | + if [[ ${{ steps.changed-files.outputs.all_changed_files_count }} != 1 ]]; then + echo "One Kubernetes patch version files should be changed for a release, found ${{ steps.changed-files.outputs.all_changed_files_count }}" + exit 1 + fi + + for changed_file in ${{ steps.changed-files.outputs.all_changed_files }}; do + export KUBERNETES_VERSION=$(echo "${changed_file}" | grep -oP '(?<=/)[^/]+(?=\.yaml)') + echo "KUBERNETES_VERSION=$KUBERNETES_VERSION" >> $GITHUB_ENV + done + - name: Build packages + run: | + make release-envtest KUBERNETES_VERSION=${{ env.KUBERNETES_VERSION }} + - name: Release + uses: softprops/action-gh-release@9d7c94cfd0a1f3ed45544c887983e9fa900f0564 # tag=v2.0.4 + with: + name: envtest-${{ env.KUBERNETES_VERSION }} + draft: true + make_latest: false + files: | + out/envtest-*.tar.gz + out/envtest-*.tar.gz.sha512 + fail_on_unmatched_files: true + - name: Create Pull Request + uses: peter-evans/create-pull-request@9153d834b60caba6d51c9b9510b087acf9f33f83 # tag=v6.0.4 + with: + commit-message: Promote envtest release for Kubernetes ${{ env.KUBERNETES_VERSION }} + title: ":seedling: Promotion of envtest release for Kubernetes ${{ env.KUBERNETES_VERSION }}" + body: | + This PR promotes the envtest release for Kubernetes ${{ env.KUBERNETES_VERSION }}. + branch: promote-envtest-${{ env.KUBERNETES_VERSION }} + add-paths: | + envtest-releases.yaml