Bump actions/setup-go from 5.4.0 to 5.5.0 #81
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (c) HashiCorp, Inc. | |
# SPDX-License-Identifier: MPL-2.0 | |
name: build | |
# We now 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: | |
branches: | |
- main | |
- release/** | |
- feature/** | |
pull_request: | |
branches: | |
- main | |
- release/** | |
- feature/** | |
types: | |
- opened | |
- synchronize | |
- reopened | |
- ready_for_review | |
env: | |
PKG_NAME: "terraform-mcp-server" | |
permissions: | |
contents: read | |
jobs: | |
get-go-version: | |
name: "Determine Go toolchain version" | |
runs-on: ubuntu-latest | |
outputs: | |
go-version: ${{ steps.get-go-version.outputs.go-version }} | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Determine 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. | |
# Specify the exact Go version (e.g., 1.22.4) in .go-version | |
# if your build requires a specific patch version of Go. | |
# Otherwise, specify the major and minor versions (e.g., 1.22), | |
# with a caveat that it can lead to builds using different | |
# patch versions of Go in a workflow run. | |
run: | | |
echo "Building with Go $(cat .go-version)" | |
echo "go-version=$(cat .go-version)" >> "$GITHUB_OUTPUT" | |
set-product-version: | |
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Set Product version | |
id: set-product-version | |
uses: hashicorp/actions-set-product-version@v2 | |
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- 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@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
with: | |
name: metadata.json | |
path: ${{ steps.generate-metadata-file.outputs.filepath }} | |
build: | |
needs: | |
- get-go-version | |
- set-product-version | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- {goos: "linux", goarch: "386"} | |
- {goos: "linux", goarch: "amd64"} | |
- {goos: "linux", goarch: "arm"} | |
- {goos: "linux", goarch: "arm64"} | |
- {goos: "darwin", goarch: "amd64"} | |
- {goos: "darwin", goarch: "arm64"} | |
- {goos: "freebsd", goarch: "386"} | |
- {goos: "freebsd", goarch: "amd64"} | |
- {goos: "windows", goarch: "386"} | |
- {goos: "windows", goarch: "amd64"} | |
- {goos: "solaris", goarch: "amd64"} | |
name: Go ${{ needs.get-go-version.outputs.go-version }} ${{ matrix.goos }} ${{ matrix.goarch }} build | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: hashicorp/actions-go-build@v1 | |
env: | |
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: | |
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: | | |
make crt-build | |
build-docker: | |
name: Docker ${{ matrix.arch }} build | |
needs: | |
- set-product-version | |
- build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- { arch: "386" } | |
- { arch: "arm" } | |
- { arch: "amd64" } | |
- { arch: "arm64" } | |
fail-fast: false # recommended during development | |
env: | |
# Windows Warning: Do not set environment variables that case-conflict with variables used within an action | |
# on windows this will cause the action to not be able to set the environment variables. | |
# In this case setting `env.version` here means the action will be unable to set `env.VERSION` internally and fail. | |
repo: ${{ github.event.repository.name }} | |
product_version: ${{ needs.set-product-version.outputs.product-version }} | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Docker Build (Action) | |
uses: hashicorp/actions-docker-build@v2 | |
with: | |
# # Add smoke test here. Below is a sample smoke test that runs the built image | |
# # and validates the version. | |
# smoke_test: | | |
# TEST_VERSION="$(docker run "${IMAGE_NAME}" | awk '/CLI version/{print $3}')" | |
# if [ "${TEST_VERSION}" != "${{ env.product_version }}" ]; then | |
# printf "fail: container smoke test, got=%q want=%q\n" "${TEST_VERSION}" "${{ env.product_version }}" | |
# exit 1 | |
# fi | |
# printf "ok: container smoke test\n" | |
version: ${{ env.product_version }} | |
target: release-default # default release image target that is specified in the Dockerfile | |
dockerfile: 'Dockerfile' | |
arch: ${{ matrix.arch }} | |
tags: | | |
docker.io/hashicorp/${{ env.repo }}:${{ env.product_version }} | |
# dev_tags are tags that get automatically pushed whenever successful | |
# builds make it to the stable channel. The intention is for these tags | |
# to be used for early testing of new code prior to official releases | |
# going out. The stable channel implies that all tests and scans have | |
# completed successfully, so these images should be _stable_ but are not | |
# intended for production use. | |
# | |
# Here we have two example dev tags. The first (ending -dev) is a tag | |
# that will be updated over-and-over as new builds arrive in stable. | |
# | |
# The second (using the git SHA) will produce a new separate tag for | |
# each commit that is built. (These can still be overridden if the same | |
# commit is built successfully a second time, but that is a less likely | |
# scenario.) These kinds of dev tags are useful if you want to be able | |
# to use Docker images built from those specific commits. | |
# | |
# NOTE: dev_tags MUST publish to the 'hashicorppreview' DockerHub org, it | |
# will fail to any other DockerHub org or registry. You can optionally | |
# prepend docker.io | |
dev_tags: | | |
docker.io/hashicorppreview/${{ env.repo }}:${{ env.product_version }}-dev | |
docker.io/hashicorppreview/${{ env.repo }}:${{ env.product_version }}-${{ github.sha }} |