From 47acc4a0b14397bfbe17c15436903d8160786d19 Mon Sep 17 00:00:00 2001 From: Daniel Mikusa Date: Wed, 10 Aug 2022 14:26:31 -0400 Subject: [PATCH] Update pipelines - Updates to most recent pipeline-builder version - Updates pipelines to use Go 1.18 - Updates pipelines to use 'go install' instead of 'go get' - Adds a pipeline to check for and update Go versions & to check for transitive go.mod updates, which dependabot does not do Signed-off-by: Daniel Mikusa --- .github/pipeline-version | 2 +- .github/pipelines-version | 1 - ...nimal-labels.yml => pb-minimal-labels.yml} | 4 +- ...e-labels.yml => pb-synchronize-labels.yml} | 2 +- .github/workflows/{tests.yml => pb-tests.yml} | 18 +++++- ...elease.yml => pb-update-draft-release.yml} | 2 +- .github/workflows/pb-update-go.yml | 61 +++++++++++++++++++ ...te-pipeline.yml => pb-update-pipeline.yml} | 7 ++- 8 files changed, 85 insertions(+), 12 deletions(-) delete mode 100644 .github/pipelines-version rename .github/workflows/{minimal-labels.yml => pb-minimal-labels.yml} (85%) rename .github/workflows/{synchronize-labels.yml => pb-synchronize-labels.yml} (93%) rename .github/workflows/{tests.yml => pb-tests.yml} (59%) rename .github/workflows/{update-draft-release.yml => pb-update-draft-release.yml} (93%) create mode 100644 .github/workflows/pb-update-go.yml rename .github/workflows/{update-pipeline.yml => pb-update-pipeline.yml} (93%) diff --git a/.github/pipeline-version b/.github/pipeline-version index 0369d0b..61b813d 100644 --- a/.github/pipeline-version +++ b/.github/pipeline-version @@ -1 +1 @@ -1.21.2 +1.25.2 diff --git a/.github/pipelines-version b/.github/pipelines-version deleted file mode 100644 index 88c5fb8..0000000 --- a/.github/pipelines-version +++ /dev/null @@ -1 +0,0 @@ -1.4.0 diff --git a/.github/workflows/minimal-labels.yml b/.github/workflows/pb-minimal-labels.yml similarity index 85% rename from .github/workflows/minimal-labels.yml rename to .github/workflows/pb-minimal-labels.yml index 1bb1fd6..8f4aab5 100644 --- a/.github/workflows/minimal-labels.yml +++ b/.github/workflows/pb-minimal-labels.yml @@ -12,7 +12,7 @@ jobs: runs-on: - ubuntu-latest steps: - - uses: mheap/github-action-required-labels@v1 + - uses: mheap/github-action-required-labels@v2 with: count: 1 labels: semver:major, semver:minor, semver:patch @@ -22,7 +22,7 @@ jobs: runs-on: - ubuntu-latest steps: - - uses: mheap/github-action-required-labels@v1 + - uses: mheap/github-action-required-labels@v2 with: count: 1 labels: type:bug, type:dependency-upgrade, type:documentation, type:enhancement, type:question, type:task diff --git a/.github/workflows/synchronize-labels.yml b/.github/workflows/pb-synchronize-labels.yml similarity index 93% rename from .github/workflows/synchronize-labels.yml rename to .github/workflows/pb-synchronize-labels.yml index c77661e..0eb715f 100644 --- a/.github/workflows/synchronize-labels.yml +++ b/.github/workflows/pb-synchronize-labels.yml @@ -2,7 +2,7 @@ name: Synchronize Labels "on": push: branches: - - main + - release-1.x paths: - .github/labels.yml jobs: diff --git a/.github/workflows/tests.yml b/.github/workflows/pb-tests.yml similarity index 59% rename from .github/workflows/tests.yml rename to .github/workflows/pb-tests.yml index 0d1fb48..2bdd031 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/pb-tests.yml @@ -3,7 +3,7 @@ name: Tests pull_request: {} push: branches: - - main + - release-1.x jobs: unit: name: Unit Test @@ -18,14 +18,26 @@ jobs: restore-keys: ${{ runner.os }}-go- - uses: actions/setup-go@v3 with: - go-version: "1.17" + go-version: "1.18" - name: Install richgo run: | #!/usr/bin/env bash set -euo pipefail - GO111MODULE=on go get -u -ldflags="-s -w" github.com/kyoh86/richgo + echo "Installing richgo ${RICHGO_VERSION}" + + mkdir -p "${HOME}"/bin + echo "${HOME}/bin" >> "${GITHUB_PATH}" + + curl \ + --location \ + --show-error \ + --silent \ + "https://github.com/kyoh86/richgo/releases/download/v${RICHGO_VERSION}/richgo_${RICHGO_VERSION}_linux_amd64.tar.gz" \ + | tar -C "${HOME}"/bin -xz richgo + env: + RICHGO_VERSION: 0.3.10 - name: Run Tests run: | #!/usr/bin/env bash diff --git a/.github/workflows/update-draft-release.yml b/.github/workflows/pb-update-draft-release.yml similarity index 93% rename from .github/workflows/update-draft-release.yml rename to .github/workflows/pb-update-draft-release.yml index 0726d99..48cf23f 100644 --- a/.github/workflows/update-draft-release.yml +++ b/.github/workflows/pb-update-draft-release.yml @@ -2,7 +2,7 @@ name: Update Draft Release "on": push: branches: - - main + - release-1.x jobs: update: name: Update Draft Release diff --git a/.github/workflows/pb-update-go.yml b/.github/workflows/pb-update-go.yml new file mode 100644 index 0000000..fd720ee --- /dev/null +++ b/.github/workflows/pb-update-go.yml @@ -0,0 +1,61 @@ +name: Update Go +"on": + schedule: + - cron: 0 2 * * 1 + workflow_dispatch: {} +jobs: + update: + name: Update Go + runs-on: + - ubuntu-latest + steps: + - uses: actions/setup-go@v3 + with: + go-version: "1.18" + - uses: actions/checkout@v3 + - name: Update Go Version + id: update-go + run: | + #!/usr/bin/env bash + + set -euo pipefail + + if [ -z "${GO_VERSION:-}" ]; then + echo "No go version set" + exit 1 + fi + + OLD_GO_VERSION=$(grep -P '^go \d\.\d+' go.mod | cut -d ' ' -f 2) + + go mod edit -go="$GO_VERSION" + go mod tidy + go get -u all + go mod tidy + + git add go.mod go.sum + git checkout -- . + + echo "::set-output name=old-go-version::${OLD_GO_VERSION}" + echo "::set-output name=go-version::${GO_VERSION}" + env: + GO_VERSION: "1.18" + - uses: peter-evans/create-pull-request@v4 + with: + author: ${{ secrets.IMPLEMENTATION_GITHUB_USERNAME }} <${{ secrets.IMPLEMENTATION_GITHUB_USERNAME }}@users.noreply.github.com> + body: |- + Bumps Go from `${{ steps.update-go.outputs.old-go-version }}` to `${{ steps.update-go.outputs.go-version }}`. + +
+ Release Notes + ${{ steps.pipeline.outputs.release-notes }} +
+ branch: update/go + commit-message: |- + Bump Go from ${{ steps.update-go.outputs.old-go-version }} to ${{ steps.update-go.outputs.go-version }} + + Bumps Go from ${{ steps.update-go.outputs.old-go-version }} to ${{ steps.update-go.outputs.go-version }}. + delete-branch: true + labels: semver:minor, type:task + signoff: true + title: Bump Go from ${{ steps.update-go.outputs.old-go-version }} to ${{ steps.update-go.outputs.go-version }} + token: ${{ secrets.IMPLEMENTATION_GITHUB_TOKEN }} diff --git a/.github/workflows/update-pipeline.yml b/.github/workflows/pb-update-pipeline.yml similarity index 93% rename from .github/workflows/update-pipeline.yml rename to .github/workflows/pb-update-pipeline.yml index eed9ccc..12667ab 100644 --- a/.github/workflows/update-pipeline.yml +++ b/.github/workflows/pb-update-pipeline.yml @@ -2,7 +2,7 @@ name: Update Pipeline "on": push: branches: - - main + - release-1.x paths: - .github/pipeline-descriptor.yml schedule: @@ -16,14 +16,14 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: "1.17" + go-version: "1.18" - name: Install octo run: | #!/usr/bin/env bash set -euo pipefail - GO111MODULE=on go get -u -ldflags="-s -w" github.com/paketo-buildpacks/pipeline-builder/cmd/octo + go install -ldflags="-s -w" github.com/paketo-buildpacks/pipeline-builder/cmd/octo@latest - uses: actions/checkout@v3 - name: Update Pipeline id: pipeline @@ -38,6 +38,7 @@ jobs: OLD_VERSION="0.0.0" fi + rm .github/workflows/pb-*.yml || true octo --descriptor "${DESCRIPTOR}" PAYLOAD=$(gh api /repos/paketo-buildpacks/pipeline-builder/releases/latest)