mirror of
https://github.com/hashicorp/packer.git
synced 2026-10-24 07:02:14 -04:00
Bumps the actions group with 7 updates in the / directory: | Package | From | To | | --- | --- | --- | | [aws-actions/configure-aws-credentials](https://github.com/aws-actions/configure-aws-credentials) | `6.2.3` | `6.3.0` | | [hashicorp/actions-generate-metadata](https://github.com/hashicorp/actions-generate-metadata) | `1.1.4` | `1.3.1` | | [actions/upload-artifact](https://github.com/actions/upload-artifact) | `7.0.1` | `7.0.2` | | [hashicorp/actions-go-build](https://github.com/hashicorp/actions-go-build) | `1.1.2` | `1.1.3` | | [hashicorp/actions-docker-build](https://github.com/hashicorp/actions-docker-build) | `2.2.1` | `2.3.0` | | [github/issue-labeler](https://github.com/github/issue-labeler) | `3.4` | `3.5` | | [actions/download-artifact](https://github.com/actions/download-artifact) | `8.0.1` | `8.0.2` | Updates `aws-actions/configure-aws-credentials` from 6.2.3 to 6.3.0 - [Release notes](https://github.com/aws-actions/configure-aws-credentials/releases) - [Changelog](https://github.com/aws-actions/configure-aws-credentials/blob/main/CHANGELOG.md) - [Commits](https://github.com/aws-actions/configure-aws-credentials/compare/e6de054238d6b7531b4efff3b6587d9aade6a06c...e1253824e5c10ff9df46874f81ed3ec929e19cfd) Updates `hashicorp/actions-generate-metadata` from 1.1.4 to 1.3.1 - [Release notes](https://github.com/hashicorp/actions-generate-metadata/releases) - [Commits](https://github.com/hashicorp/actions-generate-metadata/compare/a43468dfb100445f2c2aa52cdc3d57b2c982a0f3...aff2981e4d616c852cf7652a8019e719e7a1cce0) Updates `actions/upload-artifact` from 7.0.1 to 7.0.2 - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/043fb46d1a93c77aae656e7c1c64a875d1fc6a0a...cf430e030ddbb5b0abf93d22962f4752f3646cd9) Updates `hashicorp/actions-go-build` from 1.1.2 to 1.1.3 - [Release notes](https://github.com/hashicorp/actions-go-build/releases) - [Changelog](https://github.com/hashicorp/actions-go-build/blob/main/CHANGELOG.md) - [Commits](https://github.com/hashicorp/actions-go-build/compare/dd7ca5a30c402c933e1fe61e0ff7165e5c4ee9e4...3f078f63a57c91c3e07285183d22e47869fe0dce) Updates `hashicorp/actions-docker-build` from 2.2.1 to 2.3.0 - [Release notes](https://github.com/hashicorp/actions-docker-build/releases) - [Changelog](https://github.com/hashicorp/actions-docker-build/blob/main/CHANGELOG.md) - [Commits](https://github.com/hashicorp/actions-docker-build/compare/e12557abf02a40557313ab2839d6cd2c6705261e...595f29357108da6d4767b6a48e5f01f25de0c131) Updates `github/issue-labeler` from 3.4 to 3.5 - [Release notes](https://github.com/github/issue-labeler/releases) - [Commits](https://github.com/github/issue-labeler/compare/c1b0f9f52a63158c4adc09425e858e87b32e9685...ccca1e16fcb66762200e616fc29b57b940c1cb67) Updates `actions/download-artifact` from 8.0.1 to 8.0.2 - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c...9000827ccba6bdab643e8b6fd33ac0654aef8333) --- updated-dependencies: - dependency-name: aws-actions/configure-aws-credentials dependency-version: 6.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions - dependency-name: hashicorp/actions-generate-metadata dependency-version: 1.3.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions - dependency-name: actions/upload-artifact dependency-version: 7.0.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions - dependency-name: hashicorp/actions-go-build dependency-version: 1.1.3 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions - dependency-name: hashicorp/actions-docker-build dependency-version: 2.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions - dependency-name: github/issue-labeler dependency-version: '3.5' dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions - dependency-name: actions/download-artifact dependency-version: 8.0.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
294 lines
12 KiB
YAML
294 lines
12 KiB
YAML
#
|
|
# This GitHub action builds Packer binaries, linux packages,
|
|
# and Docker images from source, and uploads them to GitHub artifacts.
|
|
# Note that artifacts available via GitHub Artifacts are not codesigned or notarized.
|
|
#
|
|
|
|
name: build
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
workflow_call:
|
|
push:
|
|
branches:
|
|
- main
|
|
- release/**
|
|
- feature/**
|
|
|
|
env:
|
|
REPO_NAME: "packer"
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
get-go-version:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
go-version: ${{ steps.get-go-version.outputs.go-version }}
|
|
steps:
|
|
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
- 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.
|
|
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 }}
|
|
base-product-version: ${{ steps.set-product-version.outputs.base-product-version }}
|
|
product-date: ${{ steps.set-product-version.outputs.product-date }}
|
|
product-prerelease-version: ${{ steps.set-product-version.outputs.prerelease-product-version }}
|
|
set-ld-flags: ${{ steps.set-ld-flags.outputs.set-ld-flags }}
|
|
steps:
|
|
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
- name: set product version
|
|
id: set-product-version
|
|
uses: hashicorp/actions-set-product-version@d9be602dfa87e201c79a3937c038f19391c9a430 # v2.0.2
|
|
- name: set-ld-flags
|
|
id: set-ld-flags
|
|
run: |
|
|
T="github.com/hashicorp/packer/version"
|
|
echo "set-ld-flags=-s -w -B gobuildid -X ${T}.GitCommit=${GITHUB_SHA::8} -X ${T}.GitDescribe=${{ steps.set-product-version.outputs.product-version }} -X ${T}.Version=${{ steps.set-product-version.outputs.base-product-version }} -X ${T}.VersionPrerelease=${{ steps.set-product-version.outputs.prerelease-product-version }} -X ${T}.VersionMetadata=" >> $GITHUB_OUTPUT
|
|
- name: validate outputs
|
|
run: |
|
|
echo "Product Version: ${{ steps.set-product-version.outputs.product-version }}"
|
|
echo "Base Product Version: ${{ steps.set-product-version.outputs.base-product-version }}"
|
|
echo "Prerelease Version: ${{ steps.set-product-version.outputs.prerelease-product-version }}"
|
|
echo "ldflags: ${{ steps.set-ld-flags.outputs.set-ld-flags }}"
|
|
|
|
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@aff2981e4d616c852cf7652a8019e719e7a1cce0 # v1.3.1
|
|
with:
|
|
version: ${{ needs.set-product-version.outputs.product-version }}
|
|
product: ${{ env.REPO_NAME }}
|
|
repository: ${{ env.REPO_NAME }}
|
|
|
|
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
with:
|
|
name: metadata.json
|
|
path: ${{ steps.generate-metadata-file.outputs.filepath }}
|
|
|
|
build-other:
|
|
needs:
|
|
- set-product-version
|
|
- get-go-version
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
goos: [ freebsd, windows, netbsd, openbsd, solaris ]
|
|
goarch: [ "386", "amd64", "arm"]
|
|
go: [ "${{ needs.get-go-version.outputs.go-version }}" ]
|
|
exclude:
|
|
- goos: solaris
|
|
goarch: 386
|
|
- goos: solaris
|
|
goarch: arm
|
|
- goos: windows
|
|
goarch: arm
|
|
fail-fast: true
|
|
|
|
name: Go ${{ matrix.go }} ${{ matrix.goos }} ${{ matrix.goarch }} build
|
|
|
|
env:
|
|
GOPRIVATE: "github.com/hashicorp"
|
|
GO111MODULE: on
|
|
steps:
|
|
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
- name: Go Build
|
|
env:
|
|
PRODUCT_VERSION: ${{ needs.set-product-version.outputs.product-version }}
|
|
PRERELEASE_VERSION: ${{ needs.set-product-version.outputs.product-prerelease-version }}
|
|
LD_FLAGS: "${{ needs.set-product-version.outputs.set-ld-flags}}"
|
|
CGO_ENABLED: "0"
|
|
uses: hashicorp/actions-go-build@3f078f63a57c91c3e07285183d22e47869fe0dce # v1.1.3
|
|
with:
|
|
product_name: ${{ env.REPO_NAME }}
|
|
product_version: ${{ needs.set-product-version.outputs.product-version }}
|
|
go_version: ${{ matrix.go }}
|
|
os: ${{ matrix.goos }}
|
|
arch: ${{ matrix.goarch }}
|
|
reproducible: report
|
|
instructions: |-
|
|
cp LICENSE "$TARGET_DIR/LICENSE.txt"
|
|
go build -o "$BIN_PATH" -ldflags="$LD_FLAGS" -trimpath -buildvcs=false
|
|
|
|
build-linux:
|
|
needs:
|
|
- set-product-version
|
|
- get-go-version
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
goos: [ linux ]
|
|
goarch: [ "arm", "arm64", "386", "amd64", "ppc64le"]
|
|
go: [ "${{ needs.get-go-version.outputs.go-version }}" ]
|
|
fail-fast: true
|
|
|
|
name: Go ${{ matrix.go }} ${{ matrix.goos }} ${{ matrix.goarch }} build
|
|
|
|
env:
|
|
GOPRIVATE: "github.com/hashicorp"
|
|
GO111MODULE: on
|
|
|
|
steps:
|
|
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
- name: Go Build
|
|
env:
|
|
PRODUCT_VERSION: ${{ needs.set-product-version.outputs.product-version }}
|
|
PRERELEASE_VERSION: ${{ needs.set-product-version.outputs.product-prerelease-version }}
|
|
LD_FLAGS: "${{ needs.set-product-version.outputs.set-ld-flags}}"
|
|
CGO_ENABLED: "0"
|
|
uses: hashicorp/actions-go-build@3f078f63a57c91c3e07285183d22e47869fe0dce # v1.1.3
|
|
with:
|
|
product_name: ${{ env.REPO_NAME }}
|
|
product_version: ${{ needs.set-product-version.outputs.product-version }}
|
|
go_version: ${{ matrix.go }}
|
|
os: ${{ matrix.goos }}
|
|
arch: ${{ matrix.goarch }}
|
|
reproducible: report
|
|
instructions: |-
|
|
cp LICENSE "$TARGET_DIR/LICENSE.txt"
|
|
go build -o "$BIN_PATH" -ldflags="$LD_FLAGS" -trimpath -buildvcs=false
|
|
|
|
- name: Copy license file to config_dir
|
|
if: ${{ matrix.goos == 'linux' }}
|
|
env:
|
|
LICENSE_DIR: ".release/linux/package/usr/share/doc/${{ env.REPO_NAME }}"
|
|
run: |
|
|
mkdir -p "$LICENSE_DIR" && cp LICENSE "$LICENSE_DIR/LICENSE.txt"
|
|
- name: Linux Packaging
|
|
uses: hashicorp/actions-packaging-linux@006298649be64cee63e7f94a54dfcf3e14766bf6 # v1.11
|
|
with:
|
|
name: ${{ env.REPO_NAME }}
|
|
description: "HashiCorp Packer - A tool for creating identical machine images for multiple platforms from a single source configuration"
|
|
arch: ${{ matrix.goarch }}
|
|
version: ${{ needs.set-product-version.outputs.product-version }}
|
|
maintainer: "HashiCorp"
|
|
homepage: "https://www.packer.io/docs"
|
|
license: "BUSL-1.1"
|
|
binary: "dist/${{ env.REPO_NAME }}"
|
|
deb_depends: "openssl"
|
|
rpm_depends: "openssl"
|
|
config_dir: ".release/linux/package/"
|
|
- name: Add Linux Package names to env
|
|
run: |
|
|
echo "RPM_PACKAGE=$(basename out/*.rpm)" >> $GITHUB_ENV
|
|
echo "DEB_PACKAGE=$(basename out/*.deb)" >> $GITHUB_ENV
|
|
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
with:
|
|
name: ${{ env.RPM_PACKAGE }}
|
|
path: out/${{ env.RPM_PACKAGE }}
|
|
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
with:
|
|
name: ${{ env.DEB_PACKAGE }}
|
|
path: out/${{ env.DEB_PACKAGE }}
|
|
|
|
build-darwin:
|
|
needs:
|
|
- set-product-version
|
|
- get-go-version
|
|
runs-on: macos-latest
|
|
strategy:
|
|
matrix:
|
|
goos: [ darwin ]
|
|
goarch: [ "amd64", "arm64" ]
|
|
go: [ "${{ needs.get-go-version.outputs.go-version }}" ]
|
|
fail-fast: true
|
|
name: Go ${{ matrix.go }} ${{ matrix.goos }} ${{ matrix.goarch }} build
|
|
|
|
env:
|
|
GOPRIVATE: "github.com/hashicorp"
|
|
GO111MODULE: on
|
|
|
|
steps:
|
|
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
- name: Go Build
|
|
env:
|
|
PRODUCT_VERSION: ${{ needs.set-product-version.outputs.product-version }}
|
|
PRERELEASE_VERSION: ${{ needs.set-product-version.outputs.product-prerelease-version }}
|
|
LD_FLAGS: "${{ needs.set-product-version.outputs.set-ld-flags}}"
|
|
CGO_ENABLED: "0"
|
|
uses: hashicorp/actions-go-build@3f078f63a57c91c3e07285183d22e47869fe0dce # v1.1.3
|
|
with:
|
|
product_name: ${{ env.REPO_NAME }}
|
|
product_version: ${{ needs.set-product-version.outputs.product-version }}
|
|
go_version: ${{ matrix.go }}
|
|
os: ${{ matrix.goos }}
|
|
arch: ${{ matrix.goarch }}
|
|
reproducible: report
|
|
instructions: |-
|
|
cp LICENSE "$TARGET_DIR/LICENSE.txt"
|
|
go build -o "$BIN_PATH" -ldflags="$LD_FLAGS" -tags netcgo -trimpath -buildvcs=false
|
|
|
|
build-docker-light:
|
|
name: Docker light ${{ matrix.arch }} build
|
|
needs:
|
|
- set-product-version
|
|
- build-linux
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
arch: [ "arm", "arm64", "386", "amd64" ]
|
|
env:
|
|
version: ${{ needs.set-product-version.outputs.product-version }}
|
|
steps:
|
|
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
- name: Docker Build (Action)
|
|
uses: hashicorp/actions-docker-build@595f29357108da6d4767b6a48e5f01f25de0c131 # v2.3.0
|
|
with:
|
|
version: ${{ env.version }}
|
|
target: release-light
|
|
arch: ${{ matrix.arch }}
|
|
tags: |
|
|
${{ needs.set-product-version.outputs.product-prerelease-version == '' && format('docker.io/hashicorp/{0}:light', env.REPO_NAME) }}
|
|
docker.io/hashicorp/${{ env.REPO_NAME }}:light-${{ env.version }}
|
|
docker.io/hashicorp/${{ env.REPO_NAME }}:${{ env.version }}
|
|
${{ needs.set-product-version.outputs.product-prerelease-version == '' && format('public.ecr.aws/hashicorp/{0}:light', env.REPO_NAME) }}
|
|
public.ecr.aws/hashicorp/${{ env.REPO_NAME }}:light-${{ env.version }}
|
|
public.ecr.aws/hashicorp/${{ env.REPO_NAME }}:${{ env.version }}
|
|
dev_tags: |
|
|
docker.io/hashicorppreview/${{ env.REPO_NAME }}:${{ env.version }}
|
|
docker.io/hashicorppreview/${{ env.REPO_NAME }}:${{ env.version }}-${{ github.sha }}
|
|
|
|
build-docker-full:
|
|
name: Docker full ${{ matrix.arch }} build
|
|
needs:
|
|
- set-product-version
|
|
- build-linux
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
arch: [ "arm", "arm64", "386", "amd64" ]
|
|
env:
|
|
version: ${{ needs.set-product-version.outputs.product-version }}
|
|
steps:
|
|
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
- name: Docker Build (Action)
|
|
uses: hashicorp/actions-docker-build@595f29357108da6d4767b6a48e5f01f25de0c131 # v2.3.0
|
|
with:
|
|
version: ${{ env.version }}
|
|
target: release-full
|
|
arch: ${{ matrix.arch }}
|
|
tags: |
|
|
${{ needs.set-product-version.outputs.product-prerelease-version == '' && format('docker.io/hashicorp/{0}:full', env.REPO_NAME) }}
|
|
docker.io/hashicorp/${{ env.REPO_NAME }}:full-${{ env.version }}
|
|
${{ needs.set-product-version.outputs.product-prerelease-version == '' && format('public.ecr.aws/hashicorp/{0}:full', env.REPO_NAME) }}
|
|
public.ecr.aws/hashicorp/${{ env.REPO_NAME }}:full-${{ env.version }}
|
|
dev_tags: |
|
|
docker.io/hashicorppreview/${{ env.REPO_NAME }}:full-${{ env.version }}
|
|
docker.io/hashicorppreview/${{ env.REPO_NAME }}:full-${{ env.version }}-${{ github.sha }}
|