From 4dd5f3c2731daa5512de24049a162bd69aed23a4 Mon Sep 17 00:00:00 2001 From: Eduardo Apolinario <653394+eapolinario@users.noreply.github.com> Date: Tue, 14 May 2024 18:14:22 -0700 Subject: [PATCH] [monorepo] Move flytectl gh workflows to monorepo (#5354) * [flytectl] Add goreleaser dry-run job Signed-off-by: Eduardo Apolinario * Use actions/checkout@v4 Signed-off-by: Eduardo Apolinario * Add sandbox test and flytectl-release gh workflow Signed-off-by: Eduardo Apolinario * Skip flyteidl release if releasing flytectl Signed-off-by: Eduardo Apolinario * Add github token to flytectl release gh workflow Signed-off-by: Eduardo Apolinario --------- Signed-off-by: Eduardo Apolinario Co-authored-by: Eduardo Apolinario --- .github/workflows/checks.yml | 56 ++++++++++++++++++++++++++ .github/workflows/flytectl-release.yml | 27 +++++++++++++ .github/workflows/flyteidl-release.yml | 2 + flytectl/.goreleaser.yml | 6 +++ 4 files changed, 91 insertions(+) create mode 100644 .github/workflows/flytectl-release.yml diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 4c66549cb9..f6265977c1 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -117,3 +117,59 @@ jobs: secrets: FLYTE_BOT_PAT: ${{ secrets.FLYTE_BOT_PAT }} FLYTE_BOT_USERNAME: ${{ secrets.FLYTE_BOT_USERNAME }} + + dry_run_goreleaser: + name: Dry Run Goreleaser + runs-on: ubuntu-latest + needs: + - unpack-envvars + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: "0" + - uses: actions/setup-go@v4 + with: + go-version: ${{ needs.unpack-envvars.outputs.go-version }} + - name: Run GoReleaser dry run + uses: goreleaser/goreleaser-action@v5 + with: + distribution: goreleaser-pro + version: latest + args: --snapshot --skip-publish --rm-dist -f flytectl/.goreleaser.yml + env: + GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} + + sandbox: + name: Test Getting started + runs-on: ubuntu-latest + defaults: + run: + working-directory: flytectl + needs: + - unpack-envvars + steps: + - uses: insightsengineering/disk-space-reclaimer@v1 + - name: Checkout + uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }} + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: ${{ needs.unpack-envvars.outputs.go-version }} + - name: Build Flytectl binary + run: make compile + - name: Create a sandbox cluster + run: | + bin/flytectl demo start + - name: Setup flytectl config + run: bin/flytectl config init + - name: Register cookbook + run: bin/flytectl register examples -d development -p flytesnacks + - name: Teardown Sandbox cluster + run: bin/flytectl demo teardown diff --git a/.github/workflows/flytectl-release.yml b/.github/workflows/flytectl-release.yml new file mode 100644 index 0000000000..2bfa6f28eb --- /dev/null +++ b/.github/workflows/flytectl-release.yml @@ -0,0 +1,27 @@ +name: Flytectl release + +on: + push: + tags: + - flytectl/v*.*.* + +jobs: + release: + name: Goreleaser + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: "0" + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: "1.21" + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v5 + with: + distribution: goreleaser-pro + args: release --rm-dist -f flytectl/.goreleaser.yml + env: + GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} + GITHUB_TOKEN: ${{ secrets.FLYTE_BOT_PAT }} diff --git a/.github/workflows/flyteidl-release.yml b/.github/workflows/flyteidl-release.yml index c088577a40..928da14848 100644 --- a/.github/workflows/flyteidl-release.yml +++ b/.github/workflows/flyteidl-release.yml @@ -6,6 +6,7 @@ on: jobs: deploy-to-pypi: + if: "!startsWith(github.event.release.tag_name, 'flytectl/')" runs-on: ubuntu-latest defaults: run: @@ -28,6 +29,7 @@ jobs: python -m build twine upload dist/* deploy-to-npm: + if: "!startsWith(github.event.release.tag_name, 'flytectl/')" runs-on: ubuntu-latest defaults: run: diff --git a/flytectl/.goreleaser.yml b/flytectl/.goreleaser.yml index 15c88a7c5a..abd1e98367 100644 --- a/flytectl/.goreleaser.yml +++ b/flytectl/.goreleaser.yml @@ -1,3 +1,9 @@ +project_name: flytectl + +monorepo: + tag_prefix: flytectl/ + dir: flytectl + before: hooks: - go mod download