From 132b55d99a8cb5fdb0896425b6fd64574d0624eb Mon Sep 17 00:00:00 2001 From: Rafael <32229014+rafaelbreno@users.noreply.github.com> Date: Wed, 15 Jan 2025 14:03:51 -0300 Subject: [PATCH] [release-1.30] Add Release downstream components in release workflow (#7600) * Add Release downstream components in release workflow * Remove dispatch --- .github/workflows/release.yml | 54 ++++++++++++++++++++++++----------- Makefile | 4 --- scripts/dispatch | 18 ------------ 3 files changed, 37 insertions(+), 39 deletions(-) delete mode 100755 scripts/dispatch diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ba4fdaff03..13615aaa8f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -217,28 +217,48 @@ jobs: prime-username: ${{ env.PRIME_REGISTRY_USERNAME }} prime-password: ${{ env.PRIME_REGISTRY_PASSWORD }} - dispatch: + release-downstream-components: + name: "Release downstream components" needs: [release-amd64, release-arm64] - runs-on: runs-on,runner=8cpu-linux-x64,run-id=${{ github.run_id }},image=ubuntu22-full-x64,hdd=64 + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Install Dapper - run: | - curl -sL https://releases.rancher.com/dapper/latest/dapper-$(uname -s)-$(uname -m) > /usr/local/bin/dapper - chmod +x /usr/local/bin/dapper - - - name: "Read secrets" + - name: "Read Secrets" uses: rancher-eio/read-vault-secrets@main with: secrets: | - secret/data/github/repo/${{ github.repository }}/pat-username/credentials token | PAT_USERNAME ; + secret/data/github/repo/${{ github.repository }}/github/app-credentials appId | APP_ID ; + secret/data/github/repo/${{ github.repository }}/github/app-credentials privateKey | PRIVATE_KEY + + - name: Generate GitHub App token + id: generate-token + uses: actions/create-github-app-token@v1 + with: + app-id: ${{ env.APP_ID }} + private-key: ${{ env.PRIVATE_KEY }} + owner: rancher + repositories: | + rke2-upgrade + system-agent-installer-rke2 - - name: Dispatch + - name: Create release in `rancher/rke2-upgrade` + env: + GH_TOKEN: ${{ steps.generate-token.outputs.token }} run: | - dapper -f Dockerfile --target dapper make dispatch + gh release create "$GITHUB_ACTION_TAG" \ + --repo rancher/rke2-upgrade \ + --title "$GITHUB_ACTION_TAG" \ + --latest="false" \ + --notes "Automated release created from $GITHUB_ACTION_TAG tag in ${{ github.repository }}" + + - name: Create release in `rancher/system-agent-installer-rke2` env: - PAT_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PAT_USERNAME: ${{ env.PAT_USERNAME }} - GITHUB_ACTION_TAG: ${{ env.GITHUB_ACTION_TAG }} + GH_TOKEN: ${{ steps.generate-token.outputs.token }} + run: | + gh release create "$GITHUB_ACTION_TAG" \ + --repo rancher/system-agent-installer-rke2 \ + --title "$GITHUB_ACTION_TAG" \ + --latest="false" \ + --notes "Automated release created from $GITHUB_ACTION_TAG tag in ${{ github.repository }}" diff --git a/Makefile b/Makefile index 261afd66d9..f5dd8da866 100644 --- a/Makefile +++ b/Makefile @@ -124,10 +124,6 @@ publish-manifest-runtime: ## Create and push the runtime manifest publish-binary: ## Upload binaries ./scripts/publish-binary -.PHONY: dispatch -dispatch: ## Send dispatch event to rke2-upgrade repo - ./scripts/dispatch - .PHONY: package package: build ## Package the rke2 binary ./scripts/package diff --git a/scripts/dispatch b/scripts/dispatch deleted file mode 100755 index db6c3b48ad..0000000000 --- a/scripts/dispatch +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash -set -ex - -REPO="https://api.github.com/repos/rancher/rke2-upgrade/dispatches" - -# send dispatch event to REPO -curl -XPOST -u "${PAT_USERNAME}:${PAT_TOKEN}" \ - -H "Accept: application/vnd.github.everest-preview+json" \ - -H "Content-Type: application/json" $REPO \ - --data '{"event_type": "create_tag", "client_payload": {"tag":"'"$GITHUB_ACTION_TAG"'"}}' - -SYSTEM_AGENT_INSTALLER_RKE2_REPO="https://api.github.com/repos/rancher/system-agent-installer-rke2/dispatches" - -# send dispatch event to SYSTEM_AGENT_INSTALLER_RKE2_REPO -curl -XPOST -u "${PAT_USERNAME}:${PAT_TOKEN}" \ - -H "Accept: application/vnd.github.everest-preview+json" \ - -H "Content-Type: application/json" $SYSTEM_AGENT_INSTALLER_RKE2_REPO \ - --data '{"event_type": "create_tag", "client_payload": {"tag":"'"$GITHUB_ACTION_TAG"'"}}'