diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..123542de0 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,47 @@ +# Copyright 2021 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Triggers a new Github release via Github Actions +# (https://docs.github.com/en/actions/learn-github-actions/introduction-to-github-actions) and +# using Go releaser (https://github.com/goreleaser/goreleaser) whenever a new tag is created in this +# repository. The goal is to release pre-built binaries of the Go CLI tools hosted in this repo. +# See .goreleaser.yml for the Go releaser config. +name: goreleaser + +# Trigger only when a new tag is created. +on: + push: + tags: + - '*' + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Set up Go + uses: actions/setup-go@v1 + with: + go-version: 1.15 + - + name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + with: + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 000000000..5c518e0a3 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,52 @@ +# Copyright 2021 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# goreleaser config. See http://goreleaser.com for details. Builds and releases the Bazel C++/Java +# remote execution toolchain generator as pre-built binaries. +before: + # Make Go pre-download all dependencies before building any binaries to avoid clobbering parallel + # builds. + hooks: + - go mod download +builds: +- id: rbe_configs_gen + env: + main: ./cmd/rbe_configs_gen/rbe_configs_gen.go + binary: rbe_configs_gen + goos: + - linux + # Windows is untested. + - windows + goarch: + - amd64 + # Set the binary timestamp to the commit timestamp it's being + # built from to make the produced binaries deterministic. + mod_timestamp: '{{ .CommitTimestamp }}' +archives: +- + # Only upload binary assets. + format: binary + # Define how the prebuilt binaries uploaded as release assets are named. The default includes the + # version string in the binary name which is redundant because it is already included in the + # release asset's URL. + name_template: "{{ .Binary }}_{{ .Os }}_{{ .Arch }}" + +checksum: + name_template: 'checksums.txt' +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' diff --git a/cmd/rbe_configs_gen/rbe_configs_gen.go b/cmd/rbe_configs_gen/rbe_configs_gen.go index 36f3fced9..1b00e4168 100644 --- a/cmd/rbe_configs_gen/rbe_configs_gen.go +++ b/cmd/rbe_configs_gen/rbe_configs_gen.go @@ -1,3 +1,17 @@ +// Copyright 2021 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// // Binary rbe_configs_gen provides the ability to generate toolchain targets along with a default // platform target to configure Bazel to run actions remotely. package main diff --git a/cmd/rbe_configs_upload/rbe_configs_upload.go b/cmd/rbe_configs_upload/rbe_configs_upload.go index cb5a84fc4..9cf86a1d4 100644 --- a/cmd/rbe_configs_upload/rbe_configs_upload.go +++ b/cmd/rbe_configs_upload/rbe_configs_upload.go @@ -1,3 +1,17 @@ +// Copyright 2021 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// // Binary rbe_configs_upload uploads the artifacts generated by rbe_configs_gen to GCS. This tool // is meant for internal use by the owners of this repository only. // This tool will upload the given configs tarball & manifest to the following paths on GCS: diff --git a/pkg/rbeconfigsgen/options.go b/pkg/rbeconfigsgen/options.go index 256250617..615f55f9c 100644 --- a/pkg/rbeconfigsgen/options.go +++ b/pkg/rbeconfigsgen/options.go @@ -1,3 +1,17 @@ +// Copyright 2021 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// // Package rbeconfigsgen contains utilities to generate C++ & Java Toolchain configs for Bazel to be // used to run RBE builds package rbeconfigsgen diff --git a/pkg/rbeconfigsgen/rbeconfigsgen.go b/pkg/rbeconfigsgen/rbeconfigsgen.go index 438464159..c8fb1f474 100644 --- a/pkg/rbeconfigsgen/rbeconfigsgen.go +++ b/pkg/rbeconfigsgen/rbeconfigsgen.go @@ -1,3 +1,17 @@ +// Copyright 2021 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// package rbeconfigsgen import (