Bumps the actions group with 3 updates in the / directory: [actions/checkout](https://github.com/actions/checkout), [actions/setup-go](https://github.com/actions/setup-go) and [actions/cache](https://github.com/actions/cache). Updates `actions/checkout` from 6.0.2 to 7.0.0 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/de0fac2e4500dabe0009e67214ff5f5447ce83dd...9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0) Updates `actions/setup-go` from 6.4.0 to 6.5.0 - [Release notes](https://github.com/actions/setup-go/releases) - [Commits](https://github.com/actions/setup-go/compare/4a3601121dd01d1626a1e23e37211e3254c1c06c...924ae3a1cded613372ab5595356fb5720e22ba16) Updates `actions/cache` from 5.0.5 to 6.1.0 - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/27d5ce7f107fe9357f9df03efb73ab90386fccae...55cc8345863c7cc4c66a329aec7e433d2d1c52a9) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: 7.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions - dependency-name: actions/setup-go dependency-version: 6.5.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions - dependency-name: actions/cache dependency-version: 6.1.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
198 lines
8.0 KiB
YAML
198 lines
8.0 KiB
YAML
# Copyright (c) HashiCorp, Inc.
|
|
# SPDX-License-Identifier: MPL-2.0
|
|
#
|
|
# This workflow builds the product for all supported platforms and uploads the resulting
|
|
# binaries as Actions artifacts. The workflow also uploads a build metadata file
|
|
# (metadata.json) -- and a Terraform Registry manifest file (terraform-registry-manifest.json).
|
|
#
|
|
# Reference: https://github.com/hashicorp/terraform-provider-crt-example/blob/main/.github/workflows/README.md
|
|
#
|
|
|
|
name: build
|
|
|
|
# We default to running this workflow on every push to every branch.
|
|
# This provides fast feedback when build issues occur, so they can be
|
|
# fixed prior to being merged to the main branch.
|
|
#
|
|
# If you want to opt out of this, and only run the build on certain branches
|
|
# please refer to the documentation on branch filtering here:
|
|
#
|
|
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onpushbranchestagsbranches-ignoretags-ignore
|
|
#
|
|
on: [workflow_dispatch, push]
|
|
|
|
env:
|
|
PKG_NAME: "terraform-provider-boundary"
|
|
|
|
jobs:
|
|
# Detects the Go version to use for builds.
|
|
get-go-version:
|
|
name: "Detect Go toolchain version"
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
go-version: ${{ steps.get-go-version.outputs.go-version }}
|
|
steps:
|
|
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
- name: Detect Go version
|
|
id: get-go-version
|
|
# We use .go-version as our source of truth for current Go version,
|
|
# because "goenv" can react to it automatically.
|
|
run: |
|
|
echo "Building with Go $(cat .go-version)"
|
|
echo "go-version=$(cat .go-version)" >> "$GITHUB_OUTPUT"
|
|
- name: Set up Go
|
|
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
|
|
with:
|
|
go-version: "${{ steps.get-go-version.outputs.go-version }}"
|
|
cache: false
|
|
|
|
# Parses the version/VERSION file. Reference: https://github.com/hashicorp/actions-set-product-version/blob/main/README.md
|
|
#
|
|
# > This action should be implemented in product repo `build.yml` files. The action is intended to grab the version
|
|
# > from the version file at the beginning of the build, then passes those versions (along with metadata, where
|
|
# > necessary) to any workflow jobs that need version information.
|
|
set-product-version:
|
|
name: "Parse version file"
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
product-version: ${{ steps.set-product-version.outputs.product-version }}
|
|
product-base-version: ${{ steps.set-product-version.outputs.base-product-version }}
|
|
product-prerelease-version: ${{ steps.set-product-version.outputs.prerelease-product-version }}
|
|
product-minor-version: ${{ steps.set-product-version.outputs.minor-product-version }}
|
|
steps:
|
|
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
- name: Set variables
|
|
id: set-product-version
|
|
uses: hashicorp/actions-set-product-version@v2
|
|
with:
|
|
checkout: false
|
|
|
|
# Creates metadata.json file containing build metadata for consumption by CRT workflows.
|
|
#
|
|
# Reference: https://github.com/hashicorp/actions-generate-metadata/blob/main/README.md
|
|
generate-metadata-file:
|
|
needs: set-product-version
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
filepath: ${{ steps.generate-metadata-file.outputs.filepath }}
|
|
steps:
|
|
- name: "Checkout directory"
|
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
- name: Generate metadata file
|
|
id: generate-metadata-file
|
|
uses: hashicorp/actions-generate-metadata@v1
|
|
with:
|
|
version: ${{ needs.set-product-version.outputs.product-version }}
|
|
product: ${{ env.PKG_NAME }}
|
|
repositoryOwner: "hashicorp"
|
|
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: metadata.json
|
|
path: ${{ steps.generate-metadata-file.outputs.filepath }}
|
|
|
|
# Uploads an Actions artifact named terraform-registry-manifest.json.zip.
|
|
#
|
|
# The artifact contains a single file with a filename that Terraform Registry expects
|
|
# (example: terraform-provider-crt-example_2.3.6-alpha1_manifest.json). The file contents
|
|
# are identical to the terraform-registry-manifest.json file in the source repository.
|
|
upload-terraform-registry-manifest-artifact:
|
|
needs: set-product-version
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: "Checkout directory"
|
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
with:
|
|
path: ${{ env.PKG_NAME }}
|
|
- name: "Copy manifest from checkout directory to a file with the desired name"
|
|
id: terraform-registry-manifest
|
|
run: |
|
|
name="${{ env.PKG_NAME }}"
|
|
version="${{ needs.set-product-version.outputs.product-version }}"
|
|
|
|
source="${name}/terraform-registry-manifest.json"
|
|
destination="${name}_${version}_manifest.json"
|
|
|
|
cp "$source" "$destination"
|
|
echo "filename=$destination" >> "$GITHUB_OUTPUT"
|
|
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: terraform-registry-manifest.json
|
|
path: ${{ steps.terraform-registry-manifest.outputs.filename }}
|
|
if-no-files-found: error
|
|
|
|
# Builds the product for supported platforms.
|
|
#
|
|
# With `reproducible: report`, this job also reports whether the build is reproducible,
|
|
# but does not enforce it.
|
|
#
|
|
# Reference: https://github.com/hashicorp/actions-go-build/blob/main/README.md
|
|
build:
|
|
needs:
|
|
- get-go-version
|
|
- set-product-version
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: true
|
|
matrix:
|
|
goos: [freebsd, windows, linux, darwin]
|
|
goarch: ["386", "amd64", "arm", "arm64"]
|
|
exclude:
|
|
- goos: freebsd
|
|
goarch: arm64
|
|
- goos: windows
|
|
goarch: arm64
|
|
- goos: windows
|
|
goarch: arm
|
|
- goos: darwin
|
|
goarch: 386
|
|
- goos: darwin
|
|
goarch: arm
|
|
|
|
name: Go ${{ needs.get-go-version.outputs.go-version }} ${{ matrix.goos }} ${{ matrix.goarch }} build
|
|
steps:
|
|
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
- uses: hashicorp/actions-go-build@v1
|
|
env:
|
|
CGO_ENABLED: 0
|
|
BASE_VERSION: ${{ needs.set-product-version.outputs.product-base-version }}
|
|
PRERELEASE_VERSION: ${{ needs.set-product-version.outputs.product-prerelease-version}}
|
|
METADATA_VERSION: ${{ env.METADATA }}
|
|
with:
|
|
bin_name: "${{ env.PKG_NAME }}_v${{ needs.set-product-version.outputs.product-version }}_x5"
|
|
product_name: ${{ env.PKG_NAME }}
|
|
product_version: ${{ needs.set-product-version.outputs.product-version }}
|
|
go_version: ${{ needs.get-go-version.outputs.go-version }}
|
|
os: ${{ matrix.goos }}
|
|
arch: ${{ matrix.goarch }}
|
|
reproducible: report
|
|
instructions: |
|
|
go mod download && ./scripts/plugins-all.sh
|
|
go build \
|
|
-o "$BIN_PATH" \
|
|
-trimpath \
|
|
-buildvcs=false \
|
|
-ldflags "-s -w -X 'main.version=${{ needs.set-product-version.outputs.product-version }}'"
|
|
cp LICENSE "$TARGET_DIR/LICENSE.txt"
|
|
|
|
whats-next:
|
|
needs:
|
|
- build
|
|
- generate-metadata-file
|
|
- upload-terraform-registry-manifest-artifact
|
|
runs-on: ubuntu-latest
|
|
name: "What's next?"
|
|
steps:
|
|
- name: "Write a helpful summary"
|
|
run: |
|
|
github_dot_com="${{ github.server_url }}"
|
|
owner_with_name="${{ github.repository }}"
|
|
ref="${{ github.ref }}"
|
|
|
|
{
|
|
echo "### What's next?"
|
|
echo "#### For a release branch (see \`.release/ci.hcl\`)"
|
|
echo "After this \`build\` workflow run completes succesfully, you can expect the CRT \`prepare\` workflow to begin momentarily."
|
|
echo "To find the \`prepare\` workflow run, [view the checks for this commit]($github_dot_com/$owner_with_name/commits/$ref)"
|
|
} >> "$GITHUB_STEP_SUMMARY"
|
|
|