From 9df8b4fc2761f33db6fd953332d8d554b419f08c Mon Sep 17 00:00:00 2001 From: Jordan Levin <31293855+jaylevin@users.noreply.github.com> Date: Fri, 6 Oct 2023 08:52:35 -0700 Subject: [PATCH] publish to marketplace --- .github/workflows/ci.yaml | 102 ++++++++++++-------------------------- 1 file changed, 31 insertions(+), 71 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 82a3aff..1806229 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -3,22 +3,20 @@ name: CI on: push: branches: - - master - - main # TODO: change default branch to master and remove this line + - main - release-* pull_request: {} workflow_dispatch: {} env: # Common versions - GO_VERSION: '1.20' - GOLANGCI_VERSION: 'v1.52.2' + GO_VERSION: '1.18' + GOLANGCI_VERSION: 'v1.47.1' DOCKER_BUILDX_VERSION: 'v0.8.2' # Common users. We can't run a step 'if secrets.AWS_USR != ""' but we can run # a step 'if env.AWS_USR' != ""', so we copy these to succinctly test whether # credentials have been provided before trying to run steps that need them. - CONTRIB_DOCKER_USR: ${{ secrets.CONTRIB_DOCKER_USR }} XPKG_ACCESS_ID: ${{ secrets.XPKG_ACCESS_ID }} AWS_USR: ${{ secrets.AWS_USR }} @@ -44,12 +42,12 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: submodules: true - name: Setup Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: go-version: ${{ env.GO_VERSION }} @@ -74,12 +72,13 @@ jobs: - name: Vendor Dependencies run: make vendor vendor.check - # We could run 'make lint' but we prefer this action because it leaves - # 'annotations' (i.e. it comments on PRs to point out linter violations). + # This action uses its own setup-go, which always seems to use the latest + # stable version of Go. We could run 'make lint' to ensure our desired Go + # version, but we prefer this action because it leaves 'annotations' (i.e. + # it comments on PRs to point out linter violations). - name: Lint uses: golangci/golangci-lint-action@v3 with: - args: --timeout=30m version: ${{ env.GOLANGCI_VERSION }} check-diff: @@ -89,12 +88,12 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: submodules: true - name: Setup Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: go-version: ${{ env.GO_VERSION }} @@ -115,35 +114,12 @@ jobs: path: .work/pkg key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }} restore-keys: ${{ runner.os }}-pkg- + - name: Vendor Dependencies run: make vendor vendor.check - - name: make generate - run: | - make generate > /dev/null || true - - name: debug - run: | - tree .work || true - - - name: pre-process-docs - continue-on-error: true - run: | - set +e - broken_doc_file=".work/confluentinc/confluent/docs/resources/confluent_ksql_cluster.md" - if ! grep -q page_title "$broken_doc_file"; then - echo '--- - # generated by Github Action - page_title: "confluent_ksql_cluster Resource - terraform-provider-confluent" - subcategory: "" - description: |- - ---' | cat - $broken_doc_file > temp && mv temp $broken_doc_file - fi - name: Check Diff - run: | - set +e - go install golang.org/x/tools/cmd/goimports@latest - make generate && make check-diff - git status + run: make check-diff unit-tests: runs-on: ubuntu-20.04 @@ -152,7 +128,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: submodules: true @@ -160,7 +136,7 @@ jobs: run: git fetch --prune --unshallow - name: Setup Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: go-version: ${{ env.GO_VERSION }} @@ -212,7 +188,7 @@ jobs: install: true - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: submodules: true @@ -220,7 +196,7 @@ jobs: run: git fetch --prune --unshallow - name: Setup Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: go-version: ${{ env.GO_VERSION }} @@ -242,19 +218,11 @@ jobs: key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-pkg- - - name: Vendor Dependencies run: make vendor vendor.check - - name: Build Helm Chart - run: make -j2 build - env: - # We're using docker buildx, which doesn't actually load the images it - # builds by default. Specifying --load does so. - BUILD_ARGS: "--load" - - - name: Run E2E Tests - run: make e2e USE_HELM3=true + #- name: Run E2E Tests + # run: make e2e USE_HELM3=true publish-artifacts: runs-on: ubuntu-20.04 @@ -274,7 +242,7 @@ jobs: install: true - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: submodules: true @@ -282,7 +250,7 @@ jobs: run: git fetch --prune --unshallow - name: Setup Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v3 with: go-version: ${{ env.GO_VERSION }} @@ -313,20 +281,13 @@ jobs: # We're using docker buildx, which doesn't actually load the images it # builds by default. Specifying --load does so. BUILD_ARGS: "--load" - + - name: Publish Artifacts to GitHub uses: actions/upload-artifact@v2 with: name: output path: _output/** - - - name: Login to Docker - uses: docker/login-action@v1 - if: env.CONTRIB_DOCKER_USR != '' - with: - username: ${{ secrets.CONTRIB_DOCKER_USR }} - password: ${{ secrets.CONTRIB_DOCKER_PSW }} - + - name: Login to Upbound uses: docker/login-action@v1 if: env.XPKG_ACCESS_ID != '' @@ -334,21 +295,20 @@ jobs: registry: xpkg.upbound.io username: ${{ secrets.XPKG_ACCESS_ID }} password: ${{ secrets.XPKG_TOKEN }} - - - name: Publish Artifacts to S3 and Docker Hub + + - name: Publish Artifacts to S3 and Upbound Marketplace run: make -j2 publish BRANCH_NAME=${GITHUB_REF##*/} - if: env.AWS_USR != '' && env.CONTRIB_DOCKER_USR != '' + if: env.AWS_USR != '' && env.XPKG_ACCESS_ID != '' env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_USR }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PSW }} GIT_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Promote Artifacts in S3 and Docker Hub - if: github.ref == 'refs/heads/master' && env.AWS_USR != '' && env.CONTRIB_DOCKER_USR != '' + + - name: Promote Artifacts in S3 and Upbound Marketplace + if: github.ref == 'refs/heads/main' && env.AWS_USR != '' && env.XPKG_ACCESS_ID != '' run: make -j2 promote env: - BRANCH_NAME: master - CHANNEL: master + BRANCH_NAME: main + CHANNEL: main AWS_ACCESS_KEY_ID: ${{ secrets.AWS_USR }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PSW }} -