diff --git a/.github/workflows/build-tenv.yml b/.github/workflows/build-tenv.yml index ea70f95..338be88 100644 --- a/.github/workflows/build-tenv.yml +++ b/.github/workflows/build-tenv.yml @@ -14,6 +14,8 @@ on: branches: [main] paths: - ".github/workflows/build-tenv.yml" + schedule: + - cron: "20 14 * * *" # concurrency: # group: ${{ github.workflow }}-${{ github.ref }} diff --git a/.github/workflows/build-terraform-docs.yml b/.github/workflows/build-terraform-docs.yml new file mode 100644 index 0000000..53a28b6 --- /dev/null +++ b/.github/workflows/build-terraform-docs.yml @@ -0,0 +1,96 @@ +--- +# This workflow uses actions that are not certified by GitHub. They are provided +# by a third-party and are governed by separate terms of service, privacy +# policy, and support documentation. + +################################################################################ +# DO NOT EDIT THIS FILE! +# +# 1. Edit the *.gotmpl.yml files instead. +# 2. Run 'go run generate-workflow.go -p {package} -t {template}'. +################################################################################ + +name: Build terraform-docs +on: + workflow_dispatch: + push: + branches: [main] + paths: + - ".github/workflows/build-terraform-docs.yml" + pull_request: + branches: [main] + paths: + - ".github/workflows/build-terraform-docs.yml" + schedule: + - cron: '30 14 * * *' + +# Variables available to all jobs defined in this file +env: + DOCKER_BUILDKIT: 1 + REGISTRY: ${{ vars.REGISTRY }} + +# Declare default permissions as read only. +permissions: read-all + +jobs: + lookup: + runs-on: ubuntu-latest + name: Lookup current version + permissions: + packages: write + contents: read + strategy: + fail-fast: false + + container: + image: ghcr.io/northwood-labs/package-builder/ubuntu-v22.04:latest + credentials: + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + outputs: + cache_hit: ${{ steps.check.outputs.cache-hit }} + package_version: ${{ steps.lookup_version.outputs.package_version }} + + steps: + - name: Lookup latest version of package + id: lookup_version + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + echo "package_version=$(download-asset latest-tag -r terraform-docs/terraform-docs -s)" >> $GITHUB_OUTPUT + + - name: Check to see if we've already built this version + uses: actions/cache/restore@v4 + id: check + with: + key: "tenv-${{ steps.lookup_version.outputs.package_version }}" + path: "packages/terraform-docs/dist" + lookup-only: true + + build: + if: needs.lookup.outputs.cache_hit != 'true' + needs: lookup + name: Build and cache + uses: northwood-labs/package-building/.github/workflows/build-and-cache.yml@main + secrets: inherit + with: + package-name: "terraform-docs" + package-version: ${{ needs.lookup.outputs.package_version }} + + upload: + if: needs.lookup.outputs.cache_hit != 'true' + needs: build + name: Upload to S3 + uses: northwood-labs/package-building/.github/workflows/upload-to-s3.yml@main + secrets: inherit + with: + package-name: "terraform-docs" + package-version: ${{ needs.lookup.outputs.package_version }} + + metadata: + if: needs.lookup.outputs.cache_hit != 'true' + needs: upload + name: Generate metadata + uses: northwood-labs/package-building/.github/workflows/generate-rpm-meta.yml@main + secrets: inherit diff --git a/PLANNING.md b/PLANNING.md deleted file mode 100644 index 7fed065..0000000 --- a/PLANNING.md +++ /dev/null @@ -1,146 +0,0 @@ -# Planning - -## Target operating systems - -Only non-end-of-life OS releases are considered (e.g., CentOS Linux is dead). We are starting with this list, but will probably expand in the future for things that are reasonably maintainable. - -| OS | Release | End-of-life date | -|----------|-----------|---------------------------------------------------| -| [Alpine] | 3.17 | [2024-11-22](https://endoflife.date/alpine) | -| [Alpine] | 3.18 | [2025-05-09](https://endoflife.date/alpine) | -| [Alpine] | 3.19 | [2025-11-01](https://endoflife.date/alpine) | -| [Amazon] | 2 | [2025-06-30](https://endoflife.date/amazon-linux) | -| [Amazon] | 2023 | [2028-03-15](https://endoflife.date/amazon-linux) | -| [Ubuntu] | 20.04 LTS | [2025-04-02](https://endoflife.date/ubuntu) | -| [Ubuntu] | 22.04 LTS | [2027-04-01](https://endoflife.date/ubuntu) | - -> [!IMPORTANT] -> We will build exclusively for 64-bit ARM (`arm64`) and Intel-compatible (`amd64`) CPU architectures. If you need support for anything outside of those two, you should look elsewhere. - - - -### Possibly in the future - -* [AlmaLinux](https://hub.docker.com/_/almalinux) (binary compat with RHEL) -* [Debian](https://hub.docker.com/_/debian) -* [Fedora](https://hub.docker.com/_/fedora) - -## List of packages - -| ✓ | Package | Version | Toolchain | Has Release? | -|:-:|-------------------------------------------------------------------------------------------------------------|---------|------------|:------------------:| -| | [1password-cli](https://developer.1password.com/docs/cli) | latest | N/A | :white_check_mark: | -| | [actionlint](https://github.com/rhysd/actionlint) | latest | Go | :white_check_mark: | -| | [amazon-cloudwatch-agent](https://github.com/aws/amazon-cloudwatch-agent) | latest | Go | :x: | -| | [amazon-ssm-agent](https://github.com/aws/amazon-ssm-agent) | latest | Go | :x: | -| | [aws-session-manager-plugin](https://github.com/aws/session-manager-plugin) | latest | Go | :x: | -| | [aws-vault](https://github.com/99designs/aws-vault) | latest | Go | :white_check_mark: | -| | [awscli](https://github.com/aws/aws-cli) | latest | Python | :white_check_mark: | -| | [bash@5.2](https://www.gnu.org/software/bash/) | v5.2 | C/C++ | :x: | -| | [bat](https://github.com/sharkdp/bat) | latest | Rust | :white_check_mark: | -| | [bats-core](https://github.com/bats-core/bats-core) | latest | Bash | :x: | -| | [benchstat](https://golang.org/x/perf/cmd/benchstat) | latest | Go | :x: | -| | [btop](https://github.com/aristocratos/btop) | latest | C/C++ | :x: | -| | [cfn-lint](https://github.com/aws-cloudformation/cfn-lint) | latest | Python | :x: | -| | [chag](https://github.com/mtdowling/chag) | latest | Bash | :x: | -| | [chamber](https://github.com/segmentio/chamber) | latest | Go | :white_check_mark: | -| | [chromium](https://www.chromium.org/Home/) | latest | C/C++ | :white_check_mark: | -| | [cloud-nuke](https://github.com/gruntwork-io/cloud-nuke) | latest | Go | :white_check_mark: | -| | [cmark-gfm](https://github.com/github/cmark-gfm) | latest | C/C++ | :x: | -| | [container-diff](https://github.com/GoogleContainerTools/container-diff) | latest | Go | :x: | -| | [cosign](https://github.com/sigstore/cosign) | latest | Go | :white_check_mark: | -| | [crane](https://github.com/google/go-containerregistry) | latest | Go | :x: | -| | [direnv](https://github.com/direnv/direnv) | latest | Go | :white_check_mark: | -| | [dive](https://github.com/wagoodman/dive) | latest | Go | :white_check_mark: | -| | [docker-buildx](https://github.com/docker/buildx) | latest | Go | :white_check_mark: | -| | [docker-compose](https://github.com/docker/compose) | latest | Go | :white_check_mark: | -| | [driftwood](https://github.com/trufflesecurity/driftwood) | latest | Go | :white_check_mark: | -| | [duck](https://duck.sh) | latest | N/A | :white_check_mark: | -| | [editorconfig-checker](https://github.com/editorconfig-checker/editorconfig-checker) | latest | Go | :white_check_mark: | -| | [eza](https://github.com/eza-community/eza) | latest | Rust | :white_check_mark: | -| | [fd](https://github.com/sharkdp/fd) | latest | Rust | :white_check_mark: | -| | [ffmpeg](https://ffmpeg.org) | latest | C/C++ | :x: | -| | [firefox](https://firefox.com) | latest | C/C++ | :white_check_mark: | -| | [fselect](https://github.com/jhspetersson/fselect) | latest | Rust | :x: | -| | [fzf](https://github.com/junegunn/fzf) | latest | Go | :white_check_mark: | -| | [gh](https://github.com/cli/cli) | latest | Go | :white_check_mark: | -| | [git-cliff](https://github.com/orhun/git-cliff) | latest | Rust | :white_check_mark: | -| | [go-binsize-treemap](https://github.com/nikolaydubina/go-binsize-treemap) | latest | Go | :x: | -| | [go-consistent](https://github.com/quasilyte/go-consistent) | latest | Go | :x: | -| | [go-cover-treemap](https://github.com/nikolaydubina/go-cover-treemap) | latest | Go | :x: | -| | [gocovsh](https://github.com/orlangure/gocovsh) | latest | Go | :white_check_mark: | -| | [godoc](https://golang.org/x/tools/cmd/godoc) | latest | Go | :x: | -| | [golangci-lint](https://github.com/golangci/golangci-lint) | latest | Go | :white_check_mark: | -| | [golines](https://github.com/segmentio/golines) | latest | Go | :white_check_mark: | -| | [gommit](https://github.com/antham/gommit) | latest | Go | :x: | -| | [google-chrome](https://google.com/chrome/) | latest | C/C++ | :white_check_mark: | -| | [goplicate](https://github.com/ilaif/goplicate) | latest | Go | :white_check_mark: | -| | [goplicate](https://github.com/ilaif/goplicate/cmd/goplicate) | latest | Go | :white_check_mark: | -| | [goreleaser-pro](https://goreleaser.com/pro/) | latest | N/A | :white_check_mark: | -| | [goreleaser](https://github.com/goreleaser/goreleaser) | latest | Go | :white_check_mark: | -| | [gosec](https://github.com/securego/gosec/v2/cmd/gosec) | latest | Go | :white_check_mark: | -| | [gotestsum](https://github.com/gotestyourself/gotestsum) | latest | Go | :white_check_mark: | -| | [govulncheck](https://golang.org/x/vuln/cmd/govulncheck) | latest | Go | :x: | -| | [hadolint](https://github.com/hadolint/hadolint) | latest | Haskell | :white_check_mark: | -| | [hcledit](https://github.com/minamijoyo/hcledit) | latest | Go | :white_check_mark: | -| | [htop](https://github.com/htop-dev/htop) | latest | C/C++ | :x: | -| | [hugo-extended](https://github.com/gohugoio/hugo) | latest | Cgo | :white_check_mark: | -| | [hugo](https://github.com/gohugoio/hugo) | latest | Go | :white_check_mark: | -| | [iam-policy-json-to-terraform](https://github.com/flosell/iam-policy-json-to-terraform) | latest | Go | :x: | -| | [iamlive](https://github.com/iann0036/iamlive) | latest | Go | :white_check_mark: | -| | [infracost](https://github.com/infracost/infracost) | latest | Go | :white_check_mark: | -| | [jenkins-remoting-runner.jar](https://repo.jenkins-ci.org/artifactory/public/org/jenkins-ci/main/remoting/) | latest | Java | :white_check_mark: | -| | [jp](https://github.com/jmespath-community/jp) | latest | Go | :white_check_mark: | -| | [jq](https://github.com/jqlang/jq) | latest | C/C++ | :white_check_mark: | -| | [lefthook](https://github.com/evilmartians/lefthook) | latest | Go | :white_check_mark: | -| | [licensei](https://github.com/goph/licensei) | latest | Go | :white_check_mark: | -| | [lychee](https://github.com/lycheeverse/lychee/) | latest | Rust | :white_check_mark: | -| | [msedge](https://www.microsoft.com/en-us/edge/download?form=MA13FJ) | latest | C/C++ | :white_check_mark: | -| | [ncdu](https://dev.yorhel.nl/ncdu) | latest | Zig | :white_check_mark: | -| | [nfpm](https://github.com/goreleaser/nfpm) | latest | Go | :white_check_mark: | -| | [opentofu](https://github.com/opentofu/opentofu) | latest | Meta | :white_check_mark: | -| | [osquery](https://github.com/osquery/osquery) | latest | C/C++ | :white_check_mark: | -| | [osv-scanner](https://github.com/google/osv-scanner) | latest | Go | :white_check_mark: | -| | [pandoc](https://pandoc.org/installing.html) | latest | Haskell | :white_check_mark: | -| | [playwright](https://github.com/microsoft/playwright) | latest | TypeScript | :white_check_mark: | -| | [poetry](https://github.com/python-poetry/poetry) | latest | Python | :white_check_mark: | -| | [pre-commit](https://github.com/pre-commit/pre-commit) | latest | Python | :white_check_mark: | -| | [python@3.12](https://github.com/python/cpython) | v3.12 | C/C++ | :x: | -| | [reviewdog](https://github.com/reviewdog/reviewdog) | latest | Go | :x: | -| | [shellcheck](https://github.com/koalaman/shellcheck) | latest | Haskell | :white_check_mark: | -| | [shfmt](https://github.com/mvdan/sh) | latest | Go | :white_check_mark: | -| | [smrcptr](https://github.com/nikolaydubina/smrcptr) | latest | Go | :x: | -| | [sops](https://github.com/mozilla/sops) | latest | Go | :white_check_mark: | -| | [syft](https://github.com/anchore/syft) | latest | Go | :white_check_mark: | -| | [taplo](https://github.com/tamasfe/taplo) | latest | Rust | :white_check_mark: | -| | [tenv](https://github.com/tofuutils/tenv) | latest | Go | :white_check_mark: | -| | [terraform-docs](https://github.com/terraform-docs/terraform-docs) | latest | Go | :white_check_mark: | -| | [terraform](https://github.com/hashicorp/terraform) | latest | Meta | :white_check_mark: | -| | [terraformer](https://github.com/GoogleCloudPlatform/terraformer) | latest | Go | :white_check_mark: | -| | [terragrunt](https://github.com/gruntwork-io/terragrunt) | latest | Meta | :white_check_mark: | -| | [tflint-ruleset-aws](https://github.com/terraform-linters/tflint-ruleset-aws) | latest | Go | :white_check_mark: | -| | [tflint-ruleset-azurerm](https://github.com/terraform-linters/tflint-ruleset-azurerm) | latest | Go | :white_check_mark: | -| | [tflint-ruleset-google](https://github.com/terraform-linters/tflint-ruleset-google) | latest | Go | :white_check_mark: | -| | [tflint](https://github.com/terraform-linters/tflint) | latest | Go | :white_check_mark: | -| | [tfschema](https://github.com/minamijoyo/tfschema) | latest | Go | :white_check_mark: | -| | [tomljson](https://github.com/pelletier/go-toml/v2/cmd/tomljson) | latest | Go | :white_check_mark: | -| | [trivy](https://github.com/aquasecurity/trivy) | latest | Go | :white_check_mark: | -| | [trufflehog](https://github.com/trufflesecurity/trufflehog) | latest | Go | :white_check_mark: | -| | [ttyd](https://github.com/tsl0922/ttyd) | latest | C/C++ | :x: | -| | [unconvert](https://github.com/mdempsky/unconvert) | latest | Go | :x: | -| | [vhs](https://github.com/charmbracelet/vhs) | latest | Go | :x: | -| | [webp](https://developers.google.com/speed/webp/docs/compiling) | latest | C/C++ | :x: | -| | [woke](https://github.com/get-woke/woke) | latest | Go | :white_check_mark: | -| | [yamlfmt](https://github.com/google/yamlfmt) | latest | Go | :white_check_mark: | - -[Alpine]: https://hub.docker.com/_/alpine -[Amazon]: https://hub.docker.com/_/amazonlinux -[Ubuntu]: https://hub.docker.com/_/ubuntu - - diff --git a/_download-and-package.gotmpl.yml b/_download-and-package.gotmpl.yml new file mode 100644 index 0000000..2d4fd5b --- /dev/null +++ b/_download-and-package.gotmpl.yml @@ -0,0 +1,91 @@ +--- +# This workflow uses actions that are not certified by GitHub. They are provided +# by a third-party and are governed by separate terms of service, privacy +# policy, and support documentation. + +{{ .DoNotEdit }} + +name: Build {{ .Package }} +on: + workflow_dispatch: + push: + branches: [main] + paths: + - ".github/workflows/build-{{ .Package }}.yml" + pull_request: + branches: [main] + paths: + - ".github/workflows/build-{{ .Package }}.yml" + schedule: + - cron: '{{ .CronExpr }}' + +# Variables available to all jobs defined in this file +env: + DOCKER_BUILDKIT: 1 + REGISTRY: {{ "${{" }} vars.REGISTRY {{ "}}" }} + +# Declare default permissions as read only. +permissions: read-all + +jobs: + lookup: + runs-on: ubuntu-latest + name: Lookup current version + permissions: + packages: write + contents: read + strategy: + fail-fast: false + + container: + image: ghcr.io/northwood-labs/package-builder/ubuntu-v22.04:latest + credentials: + username: {{ "${{" }} github.actor {{ "}}" }} + password: {{ "${{" }} secrets.GITHUB_TOKEN {{ "}}" }} + + outputs: + cache_hit: {{ "${{" }} steps.check.outputs.cache-hit {{ "}}" }} + package_version: {{ "${{" }} steps.lookup_version.outputs.package_version {{ "}}" }} + + steps: + - name: Lookup latest version of package + id: lookup_version + env: + GITHUB_TOKEN: {{ "${{" }} secrets.GITHUB_TOKEN {{ "}}" }} + run: | + echo "package_version=$(download-asset latest-tag -r {{ .OwnerRepo }} -s)" >> $GITHUB_OUTPUT + + - name: Check to see if we've already built this version + uses: actions/cache/restore@v4 + id: check + with: + key: "tenv-{{ "${{" }} steps.lookup_version.outputs.package_version {{ "}}" }}" + path: "packages/{{ .Package }}/dist" + lookup-only: true + + build: + if: needs.lookup.outputs.cache_hit != 'true' + needs: lookup + name: Build and cache + uses: northwood-labs/package-building/.github/workflows/build-and-cache.yml@main + secrets: inherit + with: + package-name: "{{ .Package }}" + package-version: {{ "${{" }} needs.lookup.outputs.package_version {{ "}}" }} + + upload: + if: needs.lookup.outputs.cache_hit != 'true' + needs: build + name: Upload to S3 + uses: northwood-labs/package-building/.github/workflows/upload-to-s3.yml@main + secrets: inherit + with: + package-name: "{{ .Package }}" + package-version: {{ "${{" }} needs.lookup.outputs.package_version {{ "}}" }} + + metadata: + if: needs.lookup.outputs.cache_hit != 'true' + needs: upload + name: Generate metadata + uses: northwood-labs/package-building/.github/workflows/generate-rpm-meta.yml@main + secrets: inherit diff --git a/generate-workflow.go b/generate-workflow.go new file mode 100644 index 0000000..b6f7e44 --- /dev/null +++ b/generate-workflow.go @@ -0,0 +1,76 @@ +package main + +import ( + "bytes" + "flag" + "fmt" + "io" + "os" + "strings" + "text/template" + + "github.com/goware/prefixer" + "github.com/lithammer/dedent" + log "github.com/sirupsen/logrus" +) + +var ( + fCronExpr string + fOwnerRepo string + fPackage string + fTemplate string + + dockerfile *template.Template + + doNotEditWarning = strings.TrimSpace(dedent.Dedent(` +DO NOT EDIT THIS FILE! + +1. Edit the *.gotmpl.yml files instead. +2. Run 'go run generate-workflow.go -p {package} -t {template}'. +`)) +) + +func init() { + flag.StringVar(&fCronExpr, "c", "", "The cron expression for a scheduled build.") + flag.StringVar(&fOwnerRepo, "r", "", "The GitHub owner/repo to lookup.") + flag.StringVar(&fPackage, "p", "", "The name of the package to create stubs for.") + flag.StringVar(&fTemplate, "t", "", "The name of the template file to use.") + + flag.Parse() +} + +func main() { + dockerfile = template.Must(template.ParseFiles(fTemplate)) + + dockerfileFile, err := os.Create(fmt.Sprintf(".github/workflows/build-%s.yml", fPackage)) + if err != nil { + log.Fatal(err) + } + + // Do some magic to convert the DO NOT EDIT warning into a valid Dockerfile comment. + buf := bytes.NewBufferString(doNotEditWarning) + prefixReader := prefixer.New(buf, "# ") + + commentedBuf, err := io.ReadAll(prefixReader) + if err != nil { + log.Fatal(err) + } + + doNotEditStringValue := strings.TrimSpace(dedent.Dedent(` + ################################################################################ + %s + ################################################################################ + `)) + + // Take the template, execute it using variables we pass-in from the + // JSON config, and write the result to the new Dockerfile. + err = dockerfile.Execute(dockerfileFile, map[string]interface{}{ + "CronExpr": fCronExpr, + "OwnerRepo": fOwnerRepo, + "Package": fPackage, + "DoNotEdit": fmt.Sprintf(doNotEditStringValue, string(commentedBuf)), + }) + if err != nil { + log.Fatal(err) + } +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..6142eb0 --- /dev/null +++ b/go.mod @@ -0,0 +1,11 @@ +module gen + +go 1.22.1 + +require ( + github.com/goware/prefixer v0.0.0-20160118172347-395022866408 + github.com/lithammer/dedent v1.1.0 + github.com/sirupsen/logrus v1.9.3 +) + +require golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..75540df --- /dev/null +++ b/go.sum @@ -0,0 +1,19 @@ +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/goware/prefixer v0.0.0-20160118172347-395022866408 h1:Y9iQJfEqnN3/Nce9cOegemcy/9Ai5k3huT6E80F3zaw= +github.com/goware/prefixer v0.0.0-20160118172347-395022866408/go.mod h1:PE1ycukgRPJ7bJ9a1fdfQ9j8i/cEcRAoLZzbxYpNB/s= +github.com/lithammer/dedent v1.1.0 h1:VNzHMVCBNG1j0fh3OrsFRkVUwStdDArbgBWoPAffktY= +github.com/lithammer/dedent v1.1.0/go.mod h1:jrXYCQtgg0nJiN+StA2KgR7w6CiQNv9Fd/Z9BP0jIOc= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 h1:0A+M6Uqn+Eje4kHMK80dtF3JCXC4ykBgQG4Fe06QRhQ= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/packages/terraform-docs/.goreleaser.yml b/packages/terraform-docs/.goreleaser.yml new file mode 100644 index 0000000..8663fee --- /dev/null +++ b/packages/terraform-docs/.goreleaser.yml @@ -0,0 +1,23 @@ +--- +# https://goreleaser.com/customization/project/ +project_name: terraform-docs + +variables: + Vendor: terraform-docs authors + VendorHomepage: https://terraform-docs.io + License: MIT + Description: | + A utility to generate documentation from Terraform modules in various output formats. + +# https://goreleaser.com/customization/includes/ +includes: + - from_file: + path: ../shared.yml + +# https://goreleaser.com/customization/hooks/ +before: + hooks: + - cmd: | + bash ./download.sh + output: true + dir: . diff --git a/packages/terraform-docs/download.sh b/packages/terraform-docs/download.sh new file mode 100644 index 0000000..5c87172 --- /dev/null +++ b/packages/terraform-docs/download.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +set -euo pipefail + +# linux/amd64 (Intel64) +download-asset get \ + --owner-repo "terraform-docs/terraform-docs" \ + --pattern "terraform-docs-v{{.Ver}}-linux-amd64.{{.Ext}}" \ + --archive-path "terraform-docs" \ + --write-to-bin "terraform-docs_amd64" \ + ; + +# linux/arm64 (ARM64) +download-asset get \ + --owner-repo "terraform-docs/terraform-docs" \ + --pattern "terraform-docs-v{{.Ver}}-linux-arm64.{{.Ext}}" \ + --archive-path "terraform-docs" \ + --write-to-bin "terraform-docs_arm64" \ + ;