From 5f0d600d01d30204a7fac370271c863252bd5417 Mon Sep 17 00:00:00 2001 From: Thomas <9749173+uhthomas@users.noreply.github.com> Date: Thu, 18 Feb 2021 16:40:58 +0000 Subject: [PATCH] Formal release process --- .github/workflows/push.yml | 24 ------------------------ .github/workflows/release.yml | 21 +++++++++++++++++++++ .github/workflows/test.yml | 16 ++++++++++++++++ cmd/kipp/BUILD.bazel | 8 ++++---- 4 files changed, 41 insertions(+), 28 deletions(-) delete mode 100644 .github/workflows/push.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml deleted file mode 100644 index 3ce04470..00000000 --- a/.github/workflows/push.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Push -on: [push] -jobs: - push: - name: Test and push - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Install bazelisk - run: curl -L "https://github.com/bazelbuild/bazelisk/releases/download/v1.6.1/bazelisk-linux-amd64" | install -D /dev/stdin "${GITHUB_WORKSPACE}/bin/bazel" - - run: bazel test //... - - uses: azure/docker-login@v1 - if: github.ref == 'refs/heads/master' - with: - username: uhthomas - password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - - uses: docker/login-action@v1 - if: github.ref == 'refs/heads/master' - with: - registry: ghcr.io - username: $GITHUB_ACTOR - password: ${{ secrets.CR_PAT }} - - run: bazel run //cmd/kipp:push - if: github.ref == 'refs/heads/master' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..85cae81f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,21 @@ +name: Release +on: + release: + types: [published] +jobs: + push: + name: Push release tag + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install bazelisk + run: curl -L "https://github.com/bazelbuild/bazelisk/releases/download/v1.7.4/bazelisk-linux-amd64" | install -D /dev/stdin "${GITHUB_WORKSPACE}/bin/bazel" + - uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.CR_PAT }} + - run: bazel run //cmd/kipp:push + env: + GIT_COMMIT: ${{ github.sha }} + GIT_REF: ${{ github.event.release.tag_name }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..4a994657 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,16 @@ +name: Test +on: [push] +jobs: + test: + name: Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install bazelisk + run: curl -L "https://github.com/bazelbuild/bazelisk/releases/download/v1.7.4/bazelisk-linux-amd64" | install -D /dev/stdin "${GITHUB_WORKSPACE}/bin/bazel" + - uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.CR_PAT }} + - run: bazel test //... diff --git a/cmd/kipp/BUILD.bazel b/cmd/kipp/BUILD.bazel index 02e0bb89..bba14db6 100644 --- a/cmd/kipp/BUILD.bazel +++ b/cmd/kipp/BUILD.bazel @@ -33,12 +33,12 @@ go_image( load("@io_bazel_rules_docker//docker:docker.bzl", "docker_bundle") docker_bundle( - name = "kipp_bundle", + name = "bundle", images = { "index.docker.io/uhthomas/kipp:latest": ":kipp", - "index.docker.io/uhthomas/kipp:{STABLE_GIT_COMMIT}": ":kipp", + "index.docker.io/uhthomas/kipp:{STABLE_GIT_REF}": ":kipp", "ghcr.io/uhthomas/kipp:latest": ":kipp", - "ghcr.io/uhthomas/kipp:{STABLE_GIT_COMMIT}": ":kipp", + "ghcr.io/uhthomas/kipp:{STABLE_GIT_REF}": ":kipp", }, ) @@ -46,7 +46,7 @@ load("@io_bazel_rules_docker//contrib:push-all.bzl", "docker_push") docker_push( name = "push", - bundle = "kipp_bundle", + bundle = "bundle", # Pushing layers concurrently sometimes fails. # See GitHub support ticket 885486. sequential = True,