From 842edd8b6ed0fd69454b106caf24c49ab23f022f Mon Sep 17 00:00:00 2001 From: Eduardo Apolinario Date: Tue, 26 Sep 2023 00:09:04 -0700 Subject: [PATCH 1/2] Add bump git tags workflow Signed-off-by: Eduardo Apolinario --- .github/workflows/bump-tags.yml | 54 ++++++++++++++++++++++++ .github/workflows/checks.yml | 62 ++++++++++++++-------------- .github/workflows/create_release.yml | 8 ++-- .github/workflows/helm-charts.yaml | 2 +- 4 files changed, 89 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/bump-tags.yml diff --git a/.github/workflows/bump-tags.yml b/.github/workflows/bump-tags.yml new file mode 100644 index 0000000000..0d6861052f --- /dev/null +++ b/.github/workflows/bump-tags.yml @@ -0,0 +1,54 @@ +name: Bump git tags + +on: + workflow_call: + outputs: + version: + description: "Tag name" + value: ${{ jobs.bump_version.outputs.version }} +jobs: + bump_version: + name: Bump Version + runs-on: ubuntu-latest + outputs: + version: ${{ steps.bump_version.outputs.tag }} + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: '0' + # Bump patch version + - uses: rickstaa/action-get-semver@v1 + id: get_semver + with: + bump_level: "patch" + - name: Print current and next version + run: | + echo "Current version: ${{ steps.get_semver.outputs.current_version }}" + echo "Next version: ${{ steps.get_semver.outputs.next_version }}" + # Generate all tags for all components + - uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + github.rest.git.createRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: `refs/tags/${{ steps.get_semver.outputs.next_version }}`, + sha: context.sha + }) + const components = [ + "datacatalog", + "flyteadmin", + "flytecopilot", + "flyteplugins", + "flytepropeller", + "flytestdlib", + ]; + for (const c of components) { + github.rest.git.createRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: `refs/tags/${c}/${{ steps.get_semver.outputs.next_version }}`, + sha: context.sha + }) + } diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index bdae826546..d7a489b259 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -117,15 +117,16 @@ jobs: component: ${{ matrix.component }} go-version: ${{ needs.unpack-envvars.outputs.go-version }} - # TODO(monorepo): enable bump_version - # bump_version: - # name: Bump Version - # if: ${{ github.event_name != 'pull_request' }} - # needs: [ endtoend, integration, lint, tests, generate ] # Only to ensure it can successfully build - # uses: flyteorg/flytetools/.github/workflows/bump_version.yml@master - # secrets: - # FLYTE_BOT_PAT: ${{ secrets.FLYTE_BOT_PAT }} + bump-tags: + name: Bump git tags + # TODO(monorepo): skip this if author is flyte-bot? + if: ${{ github.event_name != 'pull_request' }} + needs: [ integration, lint, tests, generate ] # Only to ensure it can successfully build + uses: ./.github/workflows/bump-tags.yml + secrets: + FLYTE_BOT_PAT: ${{ secrets.FLYTE_BOT_PAT }} + # TODO(monorepo): we are not going to release any binary # goreleaser: # name: Goreleaser # needs: [ bump_version ] # Only to ensure it can successfully build @@ -135,27 +136,24 @@ jobs: # secrets: # FLYTE_BOT_PAT: ${{ secrets.FLYTE_BOT_PAT }} - # push_docker_image: - # name: Build & Push Image - # # TODO(monorepo): depend on bump_version - # # needs: [ bump_version ] - # strategy: - # fail-fast: false - # matrix: - # component: - # - datacatalog - # - flyteadmin - # - flytecopilot - # - flytepropeller - # - flytescheduler - # uses: ./.github/workflows/publish.yml - # with: - # version: "test-version-monorepo" - # component: ${{ matrix.component }} - # dockerfile: Dockerfile.${{ matrix.component }} - # # TODO(monorepo): set push to true once we depend on bump_version - # # push: true - # push: false - # secrets: - # FLYTE_BOT_PAT: ${{ secrets.FLYTE_BOT_PAT }} - # FLYTE_BOT_USERNAME: ${{ secrets.FLYTE_BOT_USERNAME }} + push_docker_image: + name: Build & Push Image + needs: [ bump-tags ] + strategy: + fail-fast: false + matrix: + component: + - datacatalog + - flyteadmin + - flytecopilot + - flytepropeller + - flytescheduler + uses: ./.github/workflows/publish.yml + with: + version: ${{ needs.bump-tags.outputs.version }} + component: ${{ matrix.component }} + dockerfile: Dockerfile.${{ matrix.component }} + push: true + secrets: + FLYTE_BOT_PAT: ${{ secrets.FLYTE_BOT_PAT }} + FLYTE_BOT_USERNAME: ${{ secrets.FLYTE_BOT_USERNAME }} diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml index 2f29edc3dd..9f807887c2 100644 --- a/.github/workflows/create_release.yml +++ b/.github/workflows/create_release.yml @@ -46,7 +46,7 @@ jobs: - name: Tag image to release version run: | for release in latest ${{ needs.bump-version.outputs.version }}; do - docker buildx imagetools create --tag "ghcr.io/flyteorg/flyte-binary-release:${release}" "ghcr.io/flyteorg/flyte-binary:sha-${{ github.sha }}" + docker buildx imagetools create --tag "ghcr.io/${{ github.repository_owner }}/flyte-binary-release:${release}" "ghcr.io/${{ github.repository_owner }}/flyte-binary:sha-${{ github.sha }}" done publish-flyte-component-image: @@ -93,7 +93,7 @@ jobs: - name: Tag Image to release version run: | for release in latest ${{ needs.bump-version.outputs.version }}; do - docker buildx imagetools create --tag "ghcr.io/flyteorg/${{ matrix.component }}-release:${release}" "ghcr.io/flyteorg/${{ matrix.component }}:${{ steps.set_version.outputs.version }}" + docker buildx imagetools create --tag "ghcr.io/${{ github.repository_owner }}/${{ matrix.component }}-release:${release}" "ghcr.io/${{ github.repository_owner }}/${{ matrix.component }}:${{ steps.set_version.outputs.version }}" done helm-release: @@ -116,7 +116,7 @@ jobs: run: | git config user.name "${{ github.actor }}" git config user.email "${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>" - - name: Preprare Flyte Helm Release + - name: Prepare Flyte Helm Release env: VERSION: ${{ needs.bump-version.outputs.version }} REPOSITORY: "https://flyteorg.github.io/flyte" @@ -138,7 +138,7 @@ jobs: with: fetch-depth: "0" - - name: Preprare Flyte Release + - name: Prepare Flyte Release env: VERSION: ${{ needs.bump-version.outputs.version }} run: | diff --git a/.github/workflows/helm-charts.yaml b/.github/workflows/helm-charts.yaml index 016280b533..6c9264e58e 100644 --- a/.github/workflows/helm-charts.yaml +++ b/.github/workflows/helm-charts.yaml @@ -45,4 +45,4 @@ jobs: working-directory: charts if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }} run: - helm push ${{ matrix.chart }}-*.tgz oci://ghcr.io/flyteorg/helm-charts + helm push ${{ matrix.chart }}-*.tgz oci://ghcr.io/${{ github.repository_owner }}/helm-charts From 61520c32c1bc9390f0a48becb1f6eb54ebe5ca0e Mon Sep 17 00:00:00 2001 From: Eduardo Apolinario Date: Tue, 26 Sep 2023 08:18:36 -0700 Subject: [PATCH 2/2] noop Signed-off-by: Eduardo Apolinario --- .github/workflows/bump-tags.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/bump-tags.yml b/.github/workflows/bump-tags.yml index 0d6861052f..06733f581b 100644 --- a/.github/workflows/bump-tags.yml +++ b/.github/workflows/bump-tags.yml @@ -21,6 +21,7 @@ jobs: id: get_semver with: bump_level: "patch" + - name: Print current and next version run: | echo "Current version: ${{ steps.get_semver.outputs.current_version }}"