From 10ed6df3614a0960e8ed7bc195909d253685cc4a Mon Sep 17 00:00:00 2001 From: aemperador Date: Tue, 1 Feb 2022 15:00:59 -0600 Subject: [PATCH] Using GoReleaser to manage GitHub releases --- .github/workflows/release.yaml | 48 ------------------------------- .goreleaser.yaml | 33 +++++++++++++++++++-- docs/contributors/releases.md | 2 +- release/goreleaser.opm.Dockerfile | 3 +- 4 files changed, 32 insertions(+), 54 deletions(-) delete mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index 6d05f2f7d..000000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,48 +0,0 @@ -name: release -on: - push: - tags: - - 'v[0-9]+.[0-9]+.[0-9]+' -defaults: - run: - shell: bash -jobs: - create: - runs-on: ubuntu-latest - outputs: - upload_url: ${{ steps.release.outputs.upload_url }} - steps: - - uses: actions/create-release@v1 - id: release - env: - GITHUB_TOKEN: ${{ github.token }} - with: - draft: true - tag_name: ${{ github.ref }} - release_name: ${{ github.ref }} - assets: - needs: create - strategy: - matrix: - os: - - ubuntu-latest - - macos-latest - - windows-latest - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-go@v2 - with: - go-version: '~1.16' - - run: | - echo "asset_path=bin/opm" >> $GITHUB_ENV - echo "asset_name=$(go env GOOS)-$(go env GOARCH)-opm$(go env GOEXE)" >> $GITHUB_ENV - - run: make ${{ env.asset_path }} - - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ github.token }} - with: - upload_url: ${{ needs.create.outputs.upload_url }} - asset_path: ${{ env.asset_path }} - asset_name: ${{ env.asset_name }} - asset_content_type: application/octet-stream diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 8049d451c..a50dfba12 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -82,6 +82,34 @@ builds: asmflags: *build-asmflags gcflags: *build-gcflags ldflags: *build-ldflags + - id: darwin-amd64 + main: ./cmd/opm + binary: opm + goos: + - darwin + goarch: + - amd64 + env: + - CC=o64-clang + mod_timestamp: "{{ .CommitTimestamp }}" + flags: *build-flags + asmflags: *build-asmflags + gcflags: *build-gcflags + ldflags: *build-ldflags + - id: darwin-arm64 + main: ./cmd/opm + binary: opm + goos: + - darwin + goarch: + - arm64 + env: + - CC=oa64e-clang + mod_timestamp: "{{ .CommitTimestamp }}" + flags: *build-flags + asmflags: *build-asmflags + gcflags: *build-gcflags + ldflags: *build-ldflags archives: - id: opm builds: @@ -90,6 +118,8 @@ archives: - linux-ppc64le - linux-s390x - windows-amd64 + - darwin-amd64 + - darwin-arm64 name_template: "{{ .Binary }}_{{ .Env.OPM_VERSION }}_{{ .Os }}_{{ .Arch }}" format: binary dockers: @@ -169,6 +199,3 @@ snapshot: release: name_template: "{{ .Env.OPM_VERSION }}" draft: true - ## Disable release steps, since a separate GitHub Action job - ## handles binary builds and release uploads - disable: true diff --git a/docs/contributors/releases.md b/docs/contributors/releases.md index 152d3ea8f..d27f06c2a 100644 --- a/docs/contributors/releases.md +++ b/docs/contributors/releases.md @@ -2,7 +2,7 @@ ## opm -Binary releases of opm are built by Github Actions, see [release.yaml](../../.github/workflows/release.yaml) for details. +Binary releases of opm are built by Github Actions, see [goreleaser.yaml](../../.github/workflows/goreleaser.yaml) for details. amd64 builds are produced for linux, macos, and windows. opm follows semantic versioning, with the latest version derived from the newest semver tag. diff --git a/release/goreleaser.opm.Dockerfile b/release/goreleaser.opm.Dockerfile index 51637d34b..5f2cd4662 100644 --- a/release/goreleaser.opm.Dockerfile +++ b/release/goreleaser.opm.Dockerfile @@ -1,6 +1,5 @@ # NOTE: This Dockerfile is used in conjuction with GoReleaser to -# build opm images. See the configurations in .goreleaser.yaml -# and .github/workflows/release.yaml. +# build opm images. See the configurations in .goreleaser.yaml. FROM alpine as grpc_health_probe ARG TARGETARCH