1
Fork 0
hermetic_cc_toolchain/tools/releaser/main.go

169 lines
3.8 KiB
Go
Raw Normal View History

releaser This is a work in progress. Next steps: 1. Add instructions to the wiki. 2. Try the new tarball on a real repository. 3. Cut the actual release. Test output for an upcoming `v1.0.2`: $ bazel run //tools/releaser -- -skip_upgrades=true -tag v1.0.2 INFO: Analyzed target //tools/releaser:releaser (1 packages loaded, 29 targets configured). INFO: Found 1 target... Target //tools/releaser:releaser up-to-date: bazel-bin/tools/releaser/releaser_/releaser INFO: Elapsed time: 1.978s, Critical Path: 1.81s INFO: 3 processes: 1 internal, 2 linux-sandbox. INFO: Build completed successfully, 3 total actions INFO: Running command line: bazel-bin/tools/releaser/releaser_/releaser '-skip_upgrades=true' -tag v1.0.2 Running pre-release checks: - SKIPPING: go update commands - gazelle - checking if repository is clean Creating tag v1.0.2 Creating archive bazel-zig-cc-v1.0.2.tar Compressing bazel-zig-cc-v1.0.2.tar Written /code/bazel-zig-cc/bazel-zig-cc-v1.0.2.tar.gz Release boilerplate: ----- load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "bazel-zig-cc", sha256 = "b0e857f8b32062a112305931437c5a7e1762287e27379c6d2d7173f0fa74e270", urls = [ "https://mirror.bazel.build/github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", "https://github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", ], ) load("@bazel-zig-cc//toolchain:defs.bzl", zig_toolchains = "toolchains") # Argument-free will pick reasonable defaults. zig_toolchains() # version, url_formats and host_platform_sha256 are can be set for those who # wish to control their Zig SDK version and where it is downloaded from zig_toolchains( version = "<...>", url_formats = [ "https://example.org/zig/zig-{host_platform}-{version}.{_ext}", ], host_platform_sha256 = { ... }, )
2023-03-10 10:45:02 +02:00
// Copyright 2023 Uber Technologies, Inc.
// Licensed under the MIT License
releaser This is a work in progress. Next steps: 1. Add instructions to the wiki. 2. Try the new tarball on a real repository. 3. Cut the actual release. Test output for an upcoming `v1.0.2`: $ bazel run //tools/releaser -- -skip_upgrades=true -tag v1.0.2 INFO: Analyzed target //tools/releaser:releaser (1 packages loaded, 29 targets configured). INFO: Found 1 target... Target //tools/releaser:releaser up-to-date: bazel-bin/tools/releaser/releaser_/releaser INFO: Elapsed time: 1.978s, Critical Path: 1.81s INFO: 3 processes: 1 internal, 2 linux-sandbox. INFO: Build completed successfully, 3 total actions INFO: Running command line: bazel-bin/tools/releaser/releaser_/releaser '-skip_upgrades=true' -tag v1.0.2 Running pre-release checks: - SKIPPING: go update commands - gazelle - checking if repository is clean Creating tag v1.0.2 Creating archive bazel-zig-cc-v1.0.2.tar Compressing bazel-zig-cc-v1.0.2.tar Written /code/bazel-zig-cc/bazel-zig-cc-v1.0.2.tar.gz Release boilerplate: ----- load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "bazel-zig-cc", sha256 = "b0e857f8b32062a112305931437c5a7e1762287e27379c6d2d7173f0fa74e270", urls = [ "https://mirror.bazel.build/github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", "https://github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", ], ) load("@bazel-zig-cc//toolchain:defs.bzl", zig_toolchains = "toolchains") # Argument-free will pick reasonable defaults. zig_toolchains() # version, url_formats and host_platform_sha256 are can be set for those who # wish to control their Zig SDK version and where it is downloaded from zig_toolchains( version = "<...>", url_formats = [ "https://example.org/zig/zig-{host_platform}-{version}.{_ext}", ], host_platform_sha256 = { ... }, )
2023-03-10 10:45:02 +02:00
// releaser is a tool for managing part of the process to release a new version of hermetic_cc_toolchain.
releaser This is a work in progress. Next steps: 1. Add instructions to the wiki. 2. Try the new tarball on a real repository. 3. Cut the actual release. Test output for an upcoming `v1.0.2`: $ bazel run //tools/releaser -- -skip_upgrades=true -tag v1.0.2 INFO: Analyzed target //tools/releaser:releaser (1 packages loaded, 29 targets configured). INFO: Found 1 target... Target //tools/releaser:releaser up-to-date: bazel-bin/tools/releaser/releaser_/releaser INFO: Elapsed time: 1.978s, Critical Path: 1.81s INFO: 3 processes: 1 internal, 2 linux-sandbox. INFO: Build completed successfully, 3 total actions INFO: Running command line: bazel-bin/tools/releaser/releaser_/releaser '-skip_upgrades=true' -tag v1.0.2 Running pre-release checks: - SKIPPING: go update commands - gazelle - checking if repository is clean Creating tag v1.0.2 Creating archive bazel-zig-cc-v1.0.2.tar Compressing bazel-zig-cc-v1.0.2.tar Written /code/bazel-zig-cc/bazel-zig-cc-v1.0.2.tar.gz Release boilerplate: ----- load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "bazel-zig-cc", sha256 = "b0e857f8b32062a112305931437c5a7e1762287e27379c6d2d7173f0fa74e270", urls = [ "https://mirror.bazel.build/github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", "https://github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", ], ) load("@bazel-zig-cc//toolchain:defs.bzl", zig_toolchains = "toolchains") # Argument-free will pick reasonable defaults. zig_toolchains() # version, url_formats and host_platform_sha256 are can be set for those who # wish to control their Zig SDK version and where it is downloaded from zig_toolchains( version = "<...>", url_formats = [ "https://example.org/zig/zig-{host_platform}-{version}.{_ext}", ], host_platform_sha256 = { ... }, )
2023-03-10 10:45:02 +02:00
package main
import (
2023-03-14 10:15:43 +02:00
"bytes"
"compress/gzip"
releaser This is a work in progress. Next steps: 1. Add instructions to the wiki. 2. Try the new tarball on a real repository. 3. Cut the actual release. Test output for an upcoming `v1.0.2`: $ bazel run //tools/releaser -- -skip_upgrades=true -tag v1.0.2 INFO: Analyzed target //tools/releaser:releaser (1 packages loaded, 29 targets configured). INFO: Found 1 target... Target //tools/releaser:releaser up-to-date: bazel-bin/tools/releaser/releaser_/releaser INFO: Elapsed time: 1.978s, Critical Path: 1.81s INFO: 3 processes: 1 internal, 2 linux-sandbox. INFO: Build completed successfully, 3 total actions INFO: Running command line: bazel-bin/tools/releaser/releaser_/releaser '-skip_upgrades=true' -tag v1.0.2 Running pre-release checks: - SKIPPING: go update commands - gazelle - checking if repository is clean Creating tag v1.0.2 Creating archive bazel-zig-cc-v1.0.2.tar Compressing bazel-zig-cc-v1.0.2.tar Written /code/bazel-zig-cc/bazel-zig-cc-v1.0.2.tar.gz Release boilerplate: ----- load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "bazel-zig-cc", sha256 = "b0e857f8b32062a112305931437c5a7e1762287e27379c6d2d7173f0fa74e270", urls = [ "https://mirror.bazel.build/github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", "https://github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", ], ) load("@bazel-zig-cc//toolchain:defs.bzl", zig_toolchains = "toolchains") # Argument-free will pick reasonable defaults. zig_toolchains() # version, url_formats and host_platform_sha256 are can be set for those who # wish to control their Zig SDK version and where it is downloaded from zig_toolchains( version = "<...>", url_formats = [ "https://example.org/zig/zig-{host_platform}-{version}.{_ext}", ], host_platform_sha256 = { ... }, )
2023-03-10 10:45:02 +02:00
"crypto/sha256"
"errors"
"flag"
"fmt"
2023-03-14 10:15:43 +02:00
"io"
releaser This is a work in progress. Next steps: 1. Add instructions to the wiki. 2. Try the new tarball on a real repository. 3. Cut the actual release. Test output for an upcoming `v1.0.2`: $ bazel run //tools/releaser -- -skip_upgrades=true -tag v1.0.2 INFO: Analyzed target //tools/releaser:releaser (1 packages loaded, 29 targets configured). INFO: Found 1 target... Target //tools/releaser:releaser up-to-date: bazel-bin/tools/releaser/releaser_/releaser INFO: Elapsed time: 1.978s, Critical Path: 1.81s INFO: 3 processes: 1 internal, 2 linux-sandbox. INFO: Build completed successfully, 3 total actions INFO: Running command line: bazel-bin/tools/releaser/releaser_/releaser '-skip_upgrades=true' -tag v1.0.2 Running pre-release checks: - SKIPPING: go update commands - gazelle - checking if repository is clean Creating tag v1.0.2 Creating archive bazel-zig-cc-v1.0.2.tar Compressing bazel-zig-cc-v1.0.2.tar Written /code/bazel-zig-cc/bazel-zig-cc-v1.0.2.tar.gz Release boilerplate: ----- load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "bazel-zig-cc", sha256 = "b0e857f8b32062a112305931437c5a7e1762287e27379c6d2d7173f0fa74e270", urls = [ "https://mirror.bazel.build/github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", "https://github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", ], ) load("@bazel-zig-cc//toolchain:defs.bzl", zig_toolchains = "toolchains") # Argument-free will pick reasonable defaults. zig_toolchains() # version, url_formats and host_platform_sha256 are can be set for those who # wish to control their Zig SDK version and where it is downloaded from zig_toolchains( version = "<...>", url_formats = [ "https://example.org/zig/zig-{host_platform}-{version}.{_ext}", ], host_platform_sha256 = { ... }, )
2023-03-10 10:45:02 +02:00
"os"
"os/exec"
"path"
"regexp"
"strings"
)
var (
// Paths to be included to the release
_paths = []string{
"LICENSE",
"README.md",
"MODULE.bazel",
releaser This is a work in progress. Next steps: 1. Add instructions to the wiki. 2. Try the new tarball on a real repository. 3. Cut the actual release. Test output for an upcoming `v1.0.2`: $ bazel run //tools/releaser -- -skip_upgrades=true -tag v1.0.2 INFO: Analyzed target //tools/releaser:releaser (1 packages loaded, 29 targets configured). INFO: Found 1 target... Target //tools/releaser:releaser up-to-date: bazel-bin/tools/releaser/releaser_/releaser INFO: Elapsed time: 1.978s, Critical Path: 1.81s INFO: 3 processes: 1 internal, 2 linux-sandbox. INFO: Build completed successfully, 3 total actions INFO: Running command line: bazel-bin/tools/releaser/releaser_/releaser '-skip_upgrades=true' -tag v1.0.2 Running pre-release checks: - SKIPPING: go update commands - gazelle - checking if repository is clean Creating tag v1.0.2 Creating archive bazel-zig-cc-v1.0.2.tar Compressing bazel-zig-cc-v1.0.2.tar Written /code/bazel-zig-cc/bazel-zig-cc-v1.0.2.tar.gz Release boilerplate: ----- load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "bazel-zig-cc", sha256 = "b0e857f8b32062a112305931437c5a7e1762287e27379c6d2d7173f0fa74e270", urls = [ "https://mirror.bazel.build/github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", "https://github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", ], ) load("@bazel-zig-cc//toolchain:defs.bzl", zig_toolchains = "toolchains") # Argument-free will pick reasonable defaults. zig_toolchains() # version, url_formats and host_platform_sha256 are can be set for those who # wish to control their Zig SDK version and where it is downloaded from zig_toolchains( version = "<...>", url_formats = [ "https://example.org/zig/zig-{host_platform}-{version}.{_ext}", ], host_platform_sha256 = { ... }, )
2023-03-10 10:45:02 +02:00
"toolchain/*",
}
// regexp for valid tags
2023-03-14 10:15:43 +02:00
tagRegexp = regexp.MustCompile(`^v([0-9]+)\.([0-9]+)(\.([0-9]+))(-rc([0-9]+))?$`)
releaser This is a work in progress. Next steps: 1. Add instructions to the wiki. 2. Try the new tarball on a real repository. 3. Cut the actual release. Test output for an upcoming `v1.0.2`: $ bazel run //tools/releaser -- -skip_upgrades=true -tag v1.0.2 INFO: Analyzed target //tools/releaser:releaser (1 packages loaded, 29 targets configured). INFO: Found 1 target... Target //tools/releaser:releaser up-to-date: bazel-bin/tools/releaser/releaser_/releaser INFO: Elapsed time: 1.978s, Critical Path: 1.81s INFO: 3 processes: 1 internal, 2 linux-sandbox. INFO: Build completed successfully, 3 total actions INFO: Running command line: bazel-bin/tools/releaser/releaser_/releaser '-skip_upgrades=true' -tag v1.0.2 Running pre-release checks: - SKIPPING: go update commands - gazelle - checking if repository is clean Creating tag v1.0.2 Creating archive bazel-zig-cc-v1.0.2.tar Compressing bazel-zig-cc-v1.0.2.tar Written /code/bazel-zig-cc/bazel-zig-cc-v1.0.2.tar.gz Release boilerplate: ----- load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "bazel-zig-cc", sha256 = "b0e857f8b32062a112305931437c5a7e1762287e27379c6d2d7173f0fa74e270", urls = [ "https://mirror.bazel.build/github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", "https://github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", ], ) load("@bazel-zig-cc//toolchain:defs.bzl", zig_toolchains = "toolchains") # Argument-free will pick reasonable defaults. zig_toolchains() # version, url_formats and host_platform_sha256 are can be set for those who # wish to control their Zig SDK version and where it is downloaded from zig_toolchains( version = "<...>", url_formats = [ "https://example.org/zig/zig-{host_platform}-{version}.{_ext}", ], host_platform_sha256 = { ... }, )
2023-03-10 10:45:02 +02:00
errTag = errors.New("tag accepts the following formats: v1.0.0 v1.0.1-rc1")
)
func main() {
if err := run(); err != nil {
2023-03-14 10:15:43 +02:00
fmt.Fprintf(os.Stderr, "error: %s\n", err)
releaser This is a work in progress. Next steps: 1. Add instructions to the wiki. 2. Try the new tarball on a real repository. 3. Cut the actual release. Test output for an upcoming `v1.0.2`: $ bazel run //tools/releaser -- -skip_upgrades=true -tag v1.0.2 INFO: Analyzed target //tools/releaser:releaser (1 packages loaded, 29 targets configured). INFO: Found 1 target... Target //tools/releaser:releaser up-to-date: bazel-bin/tools/releaser/releaser_/releaser INFO: Elapsed time: 1.978s, Critical Path: 1.81s INFO: 3 processes: 1 internal, 2 linux-sandbox. INFO: Build completed successfully, 3 total actions INFO: Running command line: bazel-bin/tools/releaser/releaser_/releaser '-skip_upgrades=true' -tag v1.0.2 Running pre-release checks: - SKIPPING: go update commands - gazelle - checking if repository is clean Creating tag v1.0.2 Creating archive bazel-zig-cc-v1.0.2.tar Compressing bazel-zig-cc-v1.0.2.tar Written /code/bazel-zig-cc/bazel-zig-cc-v1.0.2.tar.gz Release boilerplate: ----- load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "bazel-zig-cc", sha256 = "b0e857f8b32062a112305931437c5a7e1762287e27379c6d2d7173f0fa74e270", urls = [ "https://mirror.bazel.build/github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", "https://github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", ], ) load("@bazel-zig-cc//toolchain:defs.bzl", zig_toolchains = "toolchains") # Argument-free will pick reasonable defaults. zig_toolchains() # version, url_formats and host_platform_sha256 are can be set for those who # wish to control their Zig SDK version and where it is downloaded from zig_toolchains( version = "<...>", url_formats = [ "https://example.org/zig/zig-{host_platform}-{version}.{_ext}", ], host_platform_sha256 = { ... }, )
2023-03-10 10:45:02 +02:00
os.Exit(1)
}
}
func log(msg string, format ...any) {
fmt.Fprintf(flag.CommandLine.Output(), msg+"\n", format...)
}
2023-03-14 10:15:43 +02:00
func run() (_err error) {
releaser This is a work in progress. Next steps: 1. Add instructions to the wiki. 2. Try the new tarball on a real repository. 3. Cut the actual release. Test output for an upcoming `v1.0.2`: $ bazel run //tools/releaser -- -skip_upgrades=true -tag v1.0.2 INFO: Analyzed target //tools/releaser:releaser (1 packages loaded, 29 targets configured). INFO: Found 1 target... Target //tools/releaser:releaser up-to-date: bazel-bin/tools/releaser/releaser_/releaser INFO: Elapsed time: 1.978s, Critical Path: 1.81s INFO: 3 processes: 1 internal, 2 linux-sandbox. INFO: Build completed successfully, 3 total actions INFO: Running command line: bazel-bin/tools/releaser/releaser_/releaser '-skip_upgrades=true' -tag v1.0.2 Running pre-release checks: - SKIPPING: go update commands - gazelle - checking if repository is clean Creating tag v1.0.2 Creating archive bazel-zig-cc-v1.0.2.tar Compressing bazel-zig-cc-v1.0.2.tar Written /code/bazel-zig-cc/bazel-zig-cc-v1.0.2.tar.gz Release boilerplate: ----- load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "bazel-zig-cc", sha256 = "b0e857f8b32062a112305931437c5a7e1762287e27379c6d2d7173f0fa74e270", urls = [ "https://mirror.bazel.build/github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", "https://github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", ], ) load("@bazel-zig-cc//toolchain:defs.bzl", zig_toolchains = "toolchains") # Argument-free will pick reasonable defaults. zig_toolchains() # version, url_formats and host_platform_sha256 are can be set for those who # wish to control their Zig SDK version and where it is downloaded from zig_toolchains( version = "<...>", url_formats = [ "https://example.org/zig/zig-{host_platform}-{version}.{_ext}", ], host_platform_sha256 = { ... }, )
2023-03-10 10:45:02 +02:00
var (
2023-03-14 10:15:43 +02:00
repoRoot string
tag string
releaser This is a work in progress. Next steps: 1. Add instructions to the wiki. 2. Try the new tarball on a real repository. 3. Cut the actual release. Test output for an upcoming `v1.0.2`: $ bazel run //tools/releaser -- -skip_upgrades=true -tag v1.0.2 INFO: Analyzed target //tools/releaser:releaser (1 packages loaded, 29 targets configured). INFO: Found 1 target... Target //tools/releaser:releaser up-to-date: bazel-bin/tools/releaser/releaser_/releaser INFO: Elapsed time: 1.978s, Critical Path: 1.81s INFO: 3 processes: 1 internal, 2 linux-sandbox. INFO: Build completed successfully, 3 total actions INFO: Running command line: bazel-bin/tools/releaser/releaser_/releaser '-skip_upgrades=true' -tag v1.0.2 Running pre-release checks: - SKIPPING: go update commands - gazelle - checking if repository is clean Creating tag v1.0.2 Creating archive bazel-zig-cc-v1.0.2.tar Compressing bazel-zig-cc-v1.0.2.tar Written /code/bazel-zig-cc/bazel-zig-cc-v1.0.2.tar.gz Release boilerplate: ----- load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "bazel-zig-cc", sha256 = "b0e857f8b32062a112305931437c5a7e1762287e27379c6d2d7173f0fa74e270", urls = [ "https://mirror.bazel.build/github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", "https://github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", ], ) load("@bazel-zig-cc//toolchain:defs.bzl", zig_toolchains = "toolchains") # Argument-free will pick reasonable defaults. zig_toolchains() # version, url_formats and host_platform_sha256 are can be set for those who # wish to control their Zig SDK version and where it is downloaded from zig_toolchains( version = "<...>", url_formats = [ "https://example.org/zig/zig-{host_platform}-{version}.{_ext}", ], host_platform_sha256 = { ... }, )
2023-03-10 10:45:02 +02:00
)
flag.StringVar(&repoRoot, "repo_root", os.Getenv("BUILD_WORKSPACE_DIRECTORY"), "root directory of hermetic_cc_toolchain repo")
releaser This is a work in progress. Next steps: 1. Add instructions to the wiki. 2. Try the new tarball on a real repository. 3. Cut the actual release. Test output for an upcoming `v1.0.2`: $ bazel run //tools/releaser -- -skip_upgrades=true -tag v1.0.2 INFO: Analyzed target //tools/releaser:releaser (1 packages loaded, 29 targets configured). INFO: Found 1 target... Target //tools/releaser:releaser up-to-date: bazel-bin/tools/releaser/releaser_/releaser INFO: Elapsed time: 1.978s, Critical Path: 1.81s INFO: 3 processes: 1 internal, 2 linux-sandbox. INFO: Build completed successfully, 3 total actions INFO: Running command line: bazel-bin/tools/releaser/releaser_/releaser '-skip_upgrades=true' -tag v1.0.2 Running pre-release checks: - SKIPPING: go update commands - gazelle - checking if repository is clean Creating tag v1.0.2 Creating archive bazel-zig-cc-v1.0.2.tar Compressing bazel-zig-cc-v1.0.2.tar Written /code/bazel-zig-cc/bazel-zig-cc-v1.0.2.tar.gz Release boilerplate: ----- load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "bazel-zig-cc", sha256 = "b0e857f8b32062a112305931437c5a7e1762287e27379c6d2d7173f0fa74e270", urls = [ "https://mirror.bazel.build/github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", "https://github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", ], ) load("@bazel-zig-cc//toolchain:defs.bzl", zig_toolchains = "toolchains") # Argument-free will pick reasonable defaults. zig_toolchains() # version, url_formats and host_platform_sha256 are can be set for those who # wish to control their Zig SDK version and where it is downloaded from zig_toolchains( version = "<...>", url_formats = [ "https://example.org/zig/zig-{host_platform}-{version}.{_ext}", ], host_platform_sha256 = { ... }, )
2023-03-10 10:45:02 +02:00
flag.StringVar(&tag, "tag", "", "tag for this release")
flag.Usage = func() {
fmt.Fprint(flag.CommandLine.Output(), `usage: bazel run //tools/releaser -- -go_version <version> -tag <tag>
This utility is intended to handle many of the steps to release a new version.
`)
flag.PrintDefaults()
}
flag.Parse()
if tag == "" {
2023-03-14 10:15:43 +02:00
return fmt.Errorf("tag is required")
releaser This is a work in progress. Next steps: 1. Add instructions to the wiki. 2. Try the new tarball on a real repository. 3. Cut the actual release. Test output for an upcoming `v1.0.2`: $ bazel run //tools/releaser -- -skip_upgrades=true -tag v1.0.2 INFO: Analyzed target //tools/releaser:releaser (1 packages loaded, 29 targets configured). INFO: Found 1 target... Target //tools/releaser:releaser up-to-date: bazel-bin/tools/releaser/releaser_/releaser INFO: Elapsed time: 1.978s, Critical Path: 1.81s INFO: 3 processes: 1 internal, 2 linux-sandbox. INFO: Build completed successfully, 3 total actions INFO: Running command line: bazel-bin/tools/releaser/releaser_/releaser '-skip_upgrades=true' -tag v1.0.2 Running pre-release checks: - SKIPPING: go update commands - gazelle - checking if repository is clean Creating tag v1.0.2 Creating archive bazel-zig-cc-v1.0.2.tar Compressing bazel-zig-cc-v1.0.2.tar Written /code/bazel-zig-cc/bazel-zig-cc-v1.0.2.tar.gz Release boilerplate: ----- load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "bazel-zig-cc", sha256 = "b0e857f8b32062a112305931437c5a7e1762287e27379c6d2d7173f0fa74e270", urls = [ "https://mirror.bazel.build/github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", "https://github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", ], ) load("@bazel-zig-cc//toolchain:defs.bzl", zig_toolchains = "toolchains") # Argument-free will pick reasonable defaults. zig_toolchains() # version, url_formats and host_platform_sha256 are can be set for those who # wish to control their Zig SDK version and where it is downloaded from zig_toolchains( version = "<...>", url_formats = [ "https://example.org/zig/zig-{host_platform}-{version}.{_ext}", ], host_platform_sha256 = { ... }, )
2023-03-10 10:45:02 +02:00
}
if !tagRegexp.MatchString(tag) {
return errTag
}
// commands that Must Not Fail
cmds := [][]string{
{"git", "diff", "--stat", "--exit-code"},
{"git", "tag", tag},
}
log("Cutting a release:")
for _, c := range cmds {
cmd := exec.Command(c[0], c[1:]...)
cmd.Dir = repoRoot
if out, err := cmd.CombinedOutput(); err != nil {
return fmt.Errorf(
2023-03-14 10:15:43 +02:00
"run %s: %w\n%s",
releaser This is a work in progress. Next steps: 1. Add instructions to the wiki. 2. Try the new tarball on a real repository. 3. Cut the actual release. Test output for an upcoming `v1.0.2`: $ bazel run //tools/releaser -- -skip_upgrades=true -tag v1.0.2 INFO: Analyzed target //tools/releaser:releaser (1 packages loaded, 29 targets configured). INFO: Found 1 target... Target //tools/releaser:releaser up-to-date: bazel-bin/tools/releaser/releaser_/releaser INFO: Elapsed time: 1.978s, Critical Path: 1.81s INFO: 3 processes: 1 internal, 2 linux-sandbox. INFO: Build completed successfully, 3 total actions INFO: Running command line: bazel-bin/tools/releaser/releaser_/releaser '-skip_upgrades=true' -tag v1.0.2 Running pre-release checks: - SKIPPING: go update commands - gazelle - checking if repository is clean Creating tag v1.0.2 Creating archive bazel-zig-cc-v1.0.2.tar Compressing bazel-zig-cc-v1.0.2.tar Written /code/bazel-zig-cc/bazel-zig-cc-v1.0.2.tar.gz Release boilerplate: ----- load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "bazel-zig-cc", sha256 = "b0e857f8b32062a112305931437c5a7e1762287e27379c6d2d7173f0fa74e270", urls = [ "https://mirror.bazel.build/github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", "https://github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", ], ) load("@bazel-zig-cc//toolchain:defs.bzl", zig_toolchains = "toolchains") # Argument-free will pick reasonable defaults. zig_toolchains() # version, url_formats and host_platform_sha256 are can be set for those who # wish to control their Zig SDK version and where it is downloaded from zig_toolchains( version = "<...>", url_formats = [ "https://example.org/zig/zig-{host_platform}-{version}.{_ext}", ], host_platform_sha256 = { ... }, )
2023-03-10 10:45:02 +02:00
strings.Join(c, " "),
err,
out,
)
}
}
fpath := path.Join(repoRoot, fmt.Sprintf("hermetic_cc_toolchain-%s.tar.gz", tag))
2023-03-14 10:15:43 +02:00
tgz, err := os.Create(fpath)
if err != nil {
return err
}
defer func() {
if _err != nil {
os.Remove(fpath)
}
}()
hashw := sha256.New()
releaser This is a work in progress. Next steps: 1. Add instructions to the wiki. 2. Try the new tarball on a real repository. 3. Cut the actual release. Test output for an upcoming `v1.0.2`: $ bazel run //tools/releaser -- -skip_upgrades=true -tag v1.0.2 INFO: Analyzed target //tools/releaser:releaser (1 packages loaded, 29 targets configured). INFO: Found 1 target... Target //tools/releaser:releaser up-to-date: bazel-bin/tools/releaser/releaser_/releaser INFO: Elapsed time: 1.978s, Critical Path: 1.81s INFO: 3 processes: 1 internal, 2 linux-sandbox. INFO: Build completed successfully, 3 total actions INFO: Running command line: bazel-bin/tools/releaser/releaser_/releaser '-skip_upgrades=true' -tag v1.0.2 Running pre-release checks: - SKIPPING: go update commands - gazelle - checking if repository is clean Creating tag v1.0.2 Creating archive bazel-zig-cc-v1.0.2.tar Compressing bazel-zig-cc-v1.0.2.tar Written /code/bazel-zig-cc/bazel-zig-cc-v1.0.2.tar.gz Release boilerplate: ----- load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "bazel-zig-cc", sha256 = "b0e857f8b32062a112305931437c5a7e1762287e27379c6d2d7173f0fa74e270", urls = [ "https://mirror.bazel.build/github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", "https://github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", ], ) load("@bazel-zig-cc//toolchain:defs.bzl", zig_toolchains = "toolchains") # Argument-free will pick reasonable defaults. zig_toolchains() # version, url_formats and host_platform_sha256 are can be set for those who # wish to control their Zig SDK version and where it is downloaded from zig_toolchains( version = "<...>", url_formats = [ "https://example.org/zig/zig-{host_platform}-{version}.{_ext}", ], host_platform_sha256 = { ... }, )
2023-03-10 10:45:02 +02:00
2023-03-14 10:15:43 +02:00
gzw, err := gzip.NewWriterLevel(io.MultiWriter(tgz, hashw), gzip.BestCompression)
if err != nil {
return fmt.Errorf("create gzip writer: %w", err)
}
log("- creating %s", fpath)
var stderr bytes.Buffer
releaser This is a work in progress. Next steps: 1. Add instructions to the wiki. 2. Try the new tarball on a real repository. 3. Cut the actual release. Test output for an upcoming `v1.0.2`: $ bazel run //tools/releaser -- -skip_upgrades=true -tag v1.0.2 INFO: Analyzed target //tools/releaser:releaser (1 packages loaded, 29 targets configured). INFO: Found 1 target... Target //tools/releaser:releaser up-to-date: bazel-bin/tools/releaser/releaser_/releaser INFO: Elapsed time: 1.978s, Critical Path: 1.81s INFO: 3 processes: 1 internal, 2 linux-sandbox. INFO: Build completed successfully, 3 total actions INFO: Running command line: bazel-bin/tools/releaser/releaser_/releaser '-skip_upgrades=true' -tag v1.0.2 Running pre-release checks: - SKIPPING: go update commands - gazelle - checking if repository is clean Creating tag v1.0.2 Creating archive bazel-zig-cc-v1.0.2.tar Compressing bazel-zig-cc-v1.0.2.tar Written /code/bazel-zig-cc/bazel-zig-cc-v1.0.2.tar.gz Release boilerplate: ----- load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "bazel-zig-cc", sha256 = "b0e857f8b32062a112305931437c5a7e1762287e27379c6d2d7173f0fa74e270", urls = [ "https://mirror.bazel.build/github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", "https://github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", ], ) load("@bazel-zig-cc//toolchain:defs.bzl", zig_toolchains = "toolchains") # Argument-free will pick reasonable defaults. zig_toolchains() # version, url_formats and host_platform_sha256 are can be set for those who # wish to control their Zig SDK version and where it is downloaded from zig_toolchains( version = "<...>", url_formats = [ "https://example.org/zig/zig-{host_platform}-{version}.{_ext}", ], host_platform_sha256 = { ... }, )
2023-03-10 10:45:02 +02:00
cmd := exec.Command(
"git",
2023-03-14 10:15:43 +02:00
append([]string{
"archive",
"--format=tar",
// WORKSPACE in the resulting tarball needs to be much
// smaller than of hermetic_cc_toolchain. See #15.
2023-03-14 10:15:43 +02:00
"--add-file=tools/releaser/WORKSPACE",
tag,
}, _paths...)...,
releaser This is a work in progress. Next steps: 1. Add instructions to the wiki. 2. Try the new tarball on a real repository. 3. Cut the actual release. Test output for an upcoming `v1.0.2`: $ bazel run //tools/releaser -- -skip_upgrades=true -tag v1.0.2 INFO: Analyzed target //tools/releaser:releaser (1 packages loaded, 29 targets configured). INFO: Found 1 target... Target //tools/releaser:releaser up-to-date: bazel-bin/tools/releaser/releaser_/releaser INFO: Elapsed time: 1.978s, Critical Path: 1.81s INFO: 3 processes: 1 internal, 2 linux-sandbox. INFO: Build completed successfully, 3 total actions INFO: Running command line: bazel-bin/tools/releaser/releaser_/releaser '-skip_upgrades=true' -tag v1.0.2 Running pre-release checks: - SKIPPING: go update commands - gazelle - checking if repository is clean Creating tag v1.0.2 Creating archive bazel-zig-cc-v1.0.2.tar Compressing bazel-zig-cc-v1.0.2.tar Written /code/bazel-zig-cc/bazel-zig-cc-v1.0.2.tar.gz Release boilerplate: ----- load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "bazel-zig-cc", sha256 = "b0e857f8b32062a112305931437c5a7e1762287e27379c6d2d7173f0fa74e270", urls = [ "https://mirror.bazel.build/github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", "https://github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", ], ) load("@bazel-zig-cc//toolchain:defs.bzl", zig_toolchains = "toolchains") # Argument-free will pick reasonable defaults. zig_toolchains() # version, url_formats and host_platform_sha256 are can be set for those who # wish to control their Zig SDK version and where it is downloaded from zig_toolchains( version = "<...>", url_formats = [ "https://example.org/zig/zig-{host_platform}-{version}.{_ext}", ], host_platform_sha256 = { ... }, )
2023-03-10 10:45:02 +02:00
)
cmd.Dir = repoRoot
2023-03-14 10:15:43 +02:00
cmd.Stdout = gzw
cmd.Stderr = &stderr
releaser This is a work in progress. Next steps: 1. Add instructions to the wiki. 2. Try the new tarball on a real repository. 3. Cut the actual release. Test output for an upcoming `v1.0.2`: $ bazel run //tools/releaser -- -skip_upgrades=true -tag v1.0.2 INFO: Analyzed target //tools/releaser:releaser (1 packages loaded, 29 targets configured). INFO: Found 1 target... Target //tools/releaser:releaser up-to-date: bazel-bin/tools/releaser/releaser_/releaser INFO: Elapsed time: 1.978s, Critical Path: 1.81s INFO: 3 processes: 1 internal, 2 linux-sandbox. INFO: Build completed successfully, 3 total actions INFO: Running command line: bazel-bin/tools/releaser/releaser_/releaser '-skip_upgrades=true' -tag v1.0.2 Running pre-release checks: - SKIPPING: go update commands - gazelle - checking if repository is clean Creating tag v1.0.2 Creating archive bazel-zig-cc-v1.0.2.tar Compressing bazel-zig-cc-v1.0.2.tar Written /code/bazel-zig-cc/bazel-zig-cc-v1.0.2.tar.gz Release boilerplate: ----- load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "bazel-zig-cc", sha256 = "b0e857f8b32062a112305931437c5a7e1762287e27379c6d2d7173f0fa74e270", urls = [ "https://mirror.bazel.build/github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", "https://github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", ], ) load("@bazel-zig-cc//toolchain:defs.bzl", zig_toolchains = "toolchains") # Argument-free will pick reasonable defaults. zig_toolchains() # version, url_formats and host_platform_sha256 are can be set for those who # wish to control their Zig SDK version and where it is downloaded from zig_toolchains( version = "<...>", url_formats = [ "https://example.org/zig/zig-{host_platform}-{version}.{_ext}", ], host_platform_sha256 = { ... }, )
2023-03-10 10:45:02 +02:00
2023-03-14 10:15:43 +02:00
if err := cmd.Run(); err != nil {
releaser This is a work in progress. Next steps: 1. Add instructions to the wiki. 2. Try the new tarball on a real repository. 3. Cut the actual release. Test output for an upcoming `v1.0.2`: $ bazel run //tools/releaser -- -skip_upgrades=true -tag v1.0.2 INFO: Analyzed target //tools/releaser:releaser (1 packages loaded, 29 targets configured). INFO: Found 1 target... Target //tools/releaser:releaser up-to-date: bazel-bin/tools/releaser/releaser_/releaser INFO: Elapsed time: 1.978s, Critical Path: 1.81s INFO: 3 processes: 1 internal, 2 linux-sandbox. INFO: Build completed successfully, 3 total actions INFO: Running command line: bazel-bin/tools/releaser/releaser_/releaser '-skip_upgrades=true' -tag v1.0.2 Running pre-release checks: - SKIPPING: go update commands - gazelle - checking if repository is clean Creating tag v1.0.2 Creating archive bazel-zig-cc-v1.0.2.tar Compressing bazel-zig-cc-v1.0.2.tar Written /code/bazel-zig-cc/bazel-zig-cc-v1.0.2.tar.gz Release boilerplate: ----- load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "bazel-zig-cc", sha256 = "b0e857f8b32062a112305931437c5a7e1762287e27379c6d2d7173f0fa74e270", urls = [ "https://mirror.bazel.build/github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", "https://github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", ], ) load("@bazel-zig-cc//toolchain:defs.bzl", zig_toolchains = "toolchains") # Argument-free will pick reasonable defaults. zig_toolchains() # version, url_formats and host_platform_sha256 are can be set for those who # wish to control their Zig SDK version and where it is downloaded from zig_toolchains( version = "<...>", url_formats = [ "https://example.org/zig/zig-{host_platform}-{version}.{_ext}", ], host_platform_sha256 = { ... }, )
2023-03-10 10:45:02 +02:00
var exitError *exec.ExitError
errors.As(err, &exitError)
2023-03-14 10:15:43 +02:00
return fmt.Errorf("create git archive: %w\n%s", err, stderr.Bytes())
releaser This is a work in progress. Next steps: 1. Add instructions to the wiki. 2. Try the new tarball on a real repository. 3. Cut the actual release. Test output for an upcoming `v1.0.2`: $ bazel run //tools/releaser -- -skip_upgrades=true -tag v1.0.2 INFO: Analyzed target //tools/releaser:releaser (1 packages loaded, 29 targets configured). INFO: Found 1 target... Target //tools/releaser:releaser up-to-date: bazel-bin/tools/releaser/releaser_/releaser INFO: Elapsed time: 1.978s, Critical Path: 1.81s INFO: 3 processes: 1 internal, 2 linux-sandbox. INFO: Build completed successfully, 3 total actions INFO: Running command line: bazel-bin/tools/releaser/releaser_/releaser '-skip_upgrades=true' -tag v1.0.2 Running pre-release checks: - SKIPPING: go update commands - gazelle - checking if repository is clean Creating tag v1.0.2 Creating archive bazel-zig-cc-v1.0.2.tar Compressing bazel-zig-cc-v1.0.2.tar Written /code/bazel-zig-cc/bazel-zig-cc-v1.0.2.tar.gz Release boilerplate: ----- load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "bazel-zig-cc", sha256 = "b0e857f8b32062a112305931437c5a7e1762287e27379c6d2d7173f0fa74e270", urls = [ "https://mirror.bazel.build/github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", "https://github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", ], ) load("@bazel-zig-cc//toolchain:defs.bzl", zig_toolchains = "toolchains") # Argument-free will pick reasonable defaults. zig_toolchains() # version, url_formats and host_platform_sha256 are can be set for those who # wish to control their Zig SDK version and where it is downloaded from zig_toolchains( version = "<...>", url_formats = [ "https://example.org/zig/zig-{host_platform}-{version}.{_ext}", ], host_platform_sha256 = { ... }, )
2023-03-10 10:45:02 +02:00
}
2023-03-14 10:15:43 +02:00
if err := gzw.Close(); err != nil {
return fmt.Errorf("close gzip stream: %w", err)
releaser This is a work in progress. Next steps: 1. Add instructions to the wiki. 2. Try the new tarball on a real repository. 3. Cut the actual release. Test output for an upcoming `v1.0.2`: $ bazel run //tools/releaser -- -skip_upgrades=true -tag v1.0.2 INFO: Analyzed target //tools/releaser:releaser (1 packages loaded, 29 targets configured). INFO: Found 1 target... Target //tools/releaser:releaser up-to-date: bazel-bin/tools/releaser/releaser_/releaser INFO: Elapsed time: 1.978s, Critical Path: 1.81s INFO: 3 processes: 1 internal, 2 linux-sandbox. INFO: Build completed successfully, 3 total actions INFO: Running command line: bazel-bin/tools/releaser/releaser_/releaser '-skip_upgrades=true' -tag v1.0.2 Running pre-release checks: - SKIPPING: go update commands - gazelle - checking if repository is clean Creating tag v1.0.2 Creating archive bazel-zig-cc-v1.0.2.tar Compressing bazel-zig-cc-v1.0.2.tar Written /code/bazel-zig-cc/bazel-zig-cc-v1.0.2.tar.gz Release boilerplate: ----- load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "bazel-zig-cc", sha256 = "b0e857f8b32062a112305931437c5a7e1762287e27379c6d2d7173f0fa74e270", urls = [ "https://mirror.bazel.build/github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", "https://github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", ], ) load("@bazel-zig-cc//toolchain:defs.bzl", zig_toolchains = "toolchains") # Argument-free will pick reasonable defaults. zig_toolchains() # version, url_formats and host_platform_sha256 are can be set for those who # wish to control their Zig SDK version and where it is downloaded from zig_toolchains( version = "<...>", url_formats = [ "https://example.org/zig/zig-{host_platform}-{version}.{_ext}", ], host_platform_sha256 = { ... }, )
2023-03-10 10:45:02 +02:00
}
2023-03-14 10:15:43 +02:00
if err := tgz.Close(); err != nil {
return err
}
log("- wrote %s", fpath)
log("Release:\n-----\n" + genBoilerplate(tag, fmt.Sprintf("%x", hashw.Sum(nil))))
releaser This is a work in progress. Next steps: 1. Add instructions to the wiki. 2. Try the new tarball on a real repository. 3. Cut the actual release. Test output for an upcoming `v1.0.2`: $ bazel run //tools/releaser -- -skip_upgrades=true -tag v1.0.2 INFO: Analyzed target //tools/releaser:releaser (1 packages loaded, 29 targets configured). INFO: Found 1 target... Target //tools/releaser:releaser up-to-date: bazel-bin/tools/releaser/releaser_/releaser INFO: Elapsed time: 1.978s, Critical Path: 1.81s INFO: 3 processes: 1 internal, 2 linux-sandbox. INFO: Build completed successfully, 3 total actions INFO: Running command line: bazel-bin/tools/releaser/releaser_/releaser '-skip_upgrades=true' -tag v1.0.2 Running pre-release checks: - SKIPPING: go update commands - gazelle - checking if repository is clean Creating tag v1.0.2 Creating archive bazel-zig-cc-v1.0.2.tar Compressing bazel-zig-cc-v1.0.2.tar Written /code/bazel-zig-cc/bazel-zig-cc-v1.0.2.tar.gz Release boilerplate: ----- load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "bazel-zig-cc", sha256 = "b0e857f8b32062a112305931437c5a7e1762287e27379c6d2d7173f0fa74e270", urls = [ "https://mirror.bazel.build/github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", "https://github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", ], ) load("@bazel-zig-cc//toolchain:defs.bzl", zig_toolchains = "toolchains") # Argument-free will pick reasonable defaults. zig_toolchains() # version, url_formats and host_platform_sha256 are can be set for those who # wish to control their Zig SDK version and where it is downloaded from zig_toolchains( version = "<...>", url_formats = [ "https://example.org/zig/zig-{host_platform}-{version}.{_ext}", ], host_platform_sha256 = { ... }, )
2023-03-10 10:45:02 +02:00
return nil
}
func genBoilerplate(version, shasum string) string {
return fmt.Sprintf(`load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "hermetic_cc_toolchain",
releaser This is a work in progress. Next steps: 1. Add instructions to the wiki. 2. Try the new tarball on a real repository. 3. Cut the actual release. Test output for an upcoming `v1.0.2`: $ bazel run //tools/releaser -- -skip_upgrades=true -tag v1.0.2 INFO: Analyzed target //tools/releaser:releaser (1 packages loaded, 29 targets configured). INFO: Found 1 target... Target //tools/releaser:releaser up-to-date: bazel-bin/tools/releaser/releaser_/releaser INFO: Elapsed time: 1.978s, Critical Path: 1.81s INFO: 3 processes: 1 internal, 2 linux-sandbox. INFO: Build completed successfully, 3 total actions INFO: Running command line: bazel-bin/tools/releaser/releaser_/releaser '-skip_upgrades=true' -tag v1.0.2 Running pre-release checks: - SKIPPING: go update commands - gazelle - checking if repository is clean Creating tag v1.0.2 Creating archive bazel-zig-cc-v1.0.2.tar Compressing bazel-zig-cc-v1.0.2.tar Written /code/bazel-zig-cc/bazel-zig-cc-v1.0.2.tar.gz Release boilerplate: ----- load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "bazel-zig-cc", sha256 = "b0e857f8b32062a112305931437c5a7e1762287e27379c6d2d7173f0fa74e270", urls = [ "https://mirror.bazel.build/github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", "https://github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", ], ) load("@bazel-zig-cc//toolchain:defs.bzl", zig_toolchains = "toolchains") # Argument-free will pick reasonable defaults. zig_toolchains() # version, url_formats and host_platform_sha256 are can be set for those who # wish to control their Zig SDK version and where it is downloaded from zig_toolchains( version = "<...>", url_formats = [ "https://example.org/zig/zig-{host_platform}-{version}.{_ext}", ], host_platform_sha256 = { ... }, )
2023-03-10 10:45:02 +02:00
sha256 = "%[2]s",
urls = [
"https://mirror.bazel.build/github.com/uber/hermetic_cc_toolchain/releases/download/%[1]s/hermetic_cc_toolchain-%[1]s.tar.gz",
"https://github.com/uber/hermetic_cc_toolchain/releases/download/%[1]s/hermetic_cc_toolchain-%[1]s.tar.gz",
releaser This is a work in progress. Next steps: 1. Add instructions to the wiki. 2. Try the new tarball on a real repository. 3. Cut the actual release. Test output for an upcoming `v1.0.2`: $ bazel run //tools/releaser -- -skip_upgrades=true -tag v1.0.2 INFO: Analyzed target //tools/releaser:releaser (1 packages loaded, 29 targets configured). INFO: Found 1 target... Target //tools/releaser:releaser up-to-date: bazel-bin/tools/releaser/releaser_/releaser INFO: Elapsed time: 1.978s, Critical Path: 1.81s INFO: 3 processes: 1 internal, 2 linux-sandbox. INFO: Build completed successfully, 3 total actions INFO: Running command line: bazel-bin/tools/releaser/releaser_/releaser '-skip_upgrades=true' -tag v1.0.2 Running pre-release checks: - SKIPPING: go update commands - gazelle - checking if repository is clean Creating tag v1.0.2 Creating archive bazel-zig-cc-v1.0.2.tar Compressing bazel-zig-cc-v1.0.2.tar Written /code/bazel-zig-cc/bazel-zig-cc-v1.0.2.tar.gz Release boilerplate: ----- load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "bazel-zig-cc", sha256 = "b0e857f8b32062a112305931437c5a7e1762287e27379c6d2d7173f0fa74e270", urls = [ "https://mirror.bazel.build/github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", "https://github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", ], ) load("@bazel-zig-cc//toolchain:defs.bzl", zig_toolchains = "toolchains") # Argument-free will pick reasonable defaults. zig_toolchains() # version, url_formats and host_platform_sha256 are can be set for those who # wish to control their Zig SDK version and where it is downloaded from zig_toolchains( version = "<...>", url_formats = [ "https://example.org/zig/zig-{host_platform}-{version}.{_ext}", ], host_platform_sha256 = { ... }, )
2023-03-10 10:45:02 +02:00
],
)
load("@hermetic_cc_toolchain//toolchain:defs.bzl", zig_toolchains = "toolchains")
releaser This is a work in progress. Next steps: 1. Add instructions to the wiki. 2. Try the new tarball on a real repository. 3. Cut the actual release. Test output for an upcoming `v1.0.2`: $ bazel run //tools/releaser -- -skip_upgrades=true -tag v1.0.2 INFO: Analyzed target //tools/releaser:releaser (1 packages loaded, 29 targets configured). INFO: Found 1 target... Target //tools/releaser:releaser up-to-date: bazel-bin/tools/releaser/releaser_/releaser INFO: Elapsed time: 1.978s, Critical Path: 1.81s INFO: 3 processes: 1 internal, 2 linux-sandbox. INFO: Build completed successfully, 3 total actions INFO: Running command line: bazel-bin/tools/releaser/releaser_/releaser '-skip_upgrades=true' -tag v1.0.2 Running pre-release checks: - SKIPPING: go update commands - gazelle - checking if repository is clean Creating tag v1.0.2 Creating archive bazel-zig-cc-v1.0.2.tar Compressing bazel-zig-cc-v1.0.2.tar Written /code/bazel-zig-cc/bazel-zig-cc-v1.0.2.tar.gz Release boilerplate: ----- load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "bazel-zig-cc", sha256 = "b0e857f8b32062a112305931437c5a7e1762287e27379c6d2d7173f0fa74e270", urls = [ "https://mirror.bazel.build/github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", "https://github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", ], ) load("@bazel-zig-cc//toolchain:defs.bzl", zig_toolchains = "toolchains") # Argument-free will pick reasonable defaults. zig_toolchains() # version, url_formats and host_platform_sha256 are can be set for those who # wish to control their Zig SDK version and where it is downloaded from zig_toolchains( version = "<...>", url_formats = [ "https://example.org/zig/zig-{host_platform}-{version}.{_ext}", ], host_platform_sha256 = { ... }, )
2023-03-10 10:45:02 +02:00
2023-03-14 10:15:43 +02:00
# plain zig_toolchains() will pick reasonable defaults. See
# toolchain/defs.bzl:toolchains on how to change the Zig SDK path and version.
zig_toolchains()`, version, shasum)
releaser This is a work in progress. Next steps: 1. Add instructions to the wiki. 2. Try the new tarball on a real repository. 3. Cut the actual release. Test output for an upcoming `v1.0.2`: $ bazel run //tools/releaser -- -skip_upgrades=true -tag v1.0.2 INFO: Analyzed target //tools/releaser:releaser (1 packages loaded, 29 targets configured). INFO: Found 1 target... Target //tools/releaser:releaser up-to-date: bazel-bin/tools/releaser/releaser_/releaser INFO: Elapsed time: 1.978s, Critical Path: 1.81s INFO: 3 processes: 1 internal, 2 linux-sandbox. INFO: Build completed successfully, 3 total actions INFO: Running command line: bazel-bin/tools/releaser/releaser_/releaser '-skip_upgrades=true' -tag v1.0.2 Running pre-release checks: - SKIPPING: go update commands - gazelle - checking if repository is clean Creating tag v1.0.2 Creating archive bazel-zig-cc-v1.0.2.tar Compressing bazel-zig-cc-v1.0.2.tar Written /code/bazel-zig-cc/bazel-zig-cc-v1.0.2.tar.gz Release boilerplate: ----- load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") http_archive( name = "bazel-zig-cc", sha256 = "b0e857f8b32062a112305931437c5a7e1762287e27379c6d2d7173f0fa74e270", urls = [ "https://mirror.bazel.build/github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", "https://github.com/uber/bazel-zig-cc/releases/download/v1.0.2/bazel-zig-cc-v1.0.2.tar.gz", ], ) load("@bazel-zig-cc//toolchain:defs.bzl", zig_toolchains = "toolchains") # Argument-free will pick reasonable defaults. zig_toolchains() # version, url_formats and host_platform_sha256 are can be set for those who # wish to control their Zig SDK version and where it is downloaded from zig_toolchains( version = "<...>", url_formats = [ "https://example.org/zig/zig-{host_platform}-{version}.{_ext}", ], host_platform_sha256 = { ... }, )
2023-03-10 10:45:02 +02:00
}