mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
Release workflow (#173)
Signed-off-by: Marcin Białoń <mbialon@spacelift.io>
This commit is contained in:
parent
e23eea6d82
commit
1b6233617b
25
.github/workflows/release.yml
vendored
25
.github/workflows/release.yml
vendored
@ -3,8 +3,6 @@ name: release
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
tags:
|
||||
- 'v[0-9]+.[0-9]+.[0-9]+*'
|
||||
|
||||
@ -22,3 +20,26 @@ jobs:
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Fetch tags
|
||||
run: git fetch --force --tags
|
||||
|
||||
- name: Determine Go version
|
||||
id: go
|
||||
uses: ./.github/actions/go-version
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: ${{ steps.go.outputs.version }}
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v4
|
||||
with:
|
||||
version: v1.20.0
|
||||
args: release --clean --timeout=60m --snapshot=${{ !startsWith(github.ref, 'refs/tags/v') }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -25,3 +25,6 @@ vendor/
|
||||
|
||||
# Coverage
|
||||
coverage.txt
|
||||
|
||||
# GoReleaser build directory
|
||||
dist/
|
||||
|
173
.goreleaser.yaml
Normal file
173
.goreleaser.yaml
Normal file
@ -0,0 +1,173 @@
|
||||
project_name: opentf
|
||||
|
||||
before:
|
||||
hooks:
|
||||
- go mod tidy
|
||||
- go generate ./...
|
||||
- make protobuf
|
||||
|
||||
builds:
|
||||
- env:
|
||||
- CGO_ENABLED=0
|
||||
|
||||
flags:
|
||||
- "-mod=readonly"
|
||||
- "-trimpath"
|
||||
|
||||
ldflags:
|
||||
- "-s -w"
|
||||
- "-X 'github.com/placeholderplaceholderplaceholder/opentf/version.dev=no'"
|
||||
|
||||
goos:
|
||||
- linux
|
||||
- windows
|
||||
- darwin
|
||||
- freebsd
|
||||
- openbsd
|
||||
- solaris
|
||||
|
||||
goarch:
|
||||
- "386"
|
||||
- amd64
|
||||
- arm
|
||||
- arm64
|
||||
|
||||
ignore:
|
||||
- goos: freebsd
|
||||
goarch: arm64
|
||||
- goos: openbsd
|
||||
goarch: arm
|
||||
- goos: openbsd
|
||||
goarch: arm64
|
||||
- goos: solaris
|
||||
goarch: "386"
|
||||
- goos: solaris
|
||||
goarch: arm
|
||||
- goos: solaris
|
||||
goarch: arm64
|
||||
- goos: windows
|
||||
goarch: arm
|
||||
- goos: windows
|
||||
goarch: arm64
|
||||
- goos: darwin
|
||||
goarch: "386"
|
||||
- goos: darwin
|
||||
goarch: arm
|
||||
|
||||
archives:
|
||||
- format: zip
|
||||
name_template: "{{ .ProjectName }}_{{ .Version }}_{{- .Os }}_{{- .Arch }}"
|
||||
|
||||
dockers:
|
||||
- use: buildx
|
||||
goarch: amd64
|
||||
build_flag_templates:
|
||||
- "--pull"
|
||||
- "--platform=linux/amd64"
|
||||
- "--label=org.opencontainers.image.title={{ .ProjectName }}"
|
||||
- "--label=org.opencontainers.image.vendor=OpenTF"
|
||||
- "--label=org.opencontainers.image.description=OpenTF {{ .Version }}"
|
||||
- "--label=org.opencontainers.image.url=https://github.com/opentffoundation/opentf"
|
||||
- "--label=org.opencontainers.image.documentation=https://github.com/opentffoundation/opentf/blob/main/README.md"
|
||||
- "--label=org.opencontainers.image.source=https://github.com/opentffoundation/opentf"
|
||||
- "--label=org.opencontainers.image.licenses=MPL-2.0"
|
||||
- "--label=org.opencontainers.image.version={{ .Version }}"
|
||||
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
|
||||
- "--label=org.opencontainers.image.created={{ time \"2006-01-02T15:04:05Z07:00\" }}"
|
||||
image_templates:
|
||||
- "ghcr.io/opentffoundation/opentf:{{ .Version }}-amd64"
|
||||
|
||||
- use: buildx
|
||||
goarch: arm64
|
||||
build_flag_templates:
|
||||
- "--pull"
|
||||
- "--platform=linux/arm64"
|
||||
- "--label=org.opencontainers.image.title={{ .ProjectName }}"
|
||||
- "--label=org.opencontainers.image.vendor=OpenTF"
|
||||
- "--label=org.opencontainers.image.description=OpenTF {{ .Version }}"
|
||||
- "--label=org.opencontainers.image.url=https://github.com/opentffoundation/opentf"
|
||||
- "--label=org.opencontainers.image.documentation=https://github.com/opentffoundation/opentf/blob/main/README.md"
|
||||
- "--label=org.opencontainers.image.source=https://github.com/opentffoundation/opentf"
|
||||
- "--label=org.opencontainers.image.licenses=MPL-2.0"
|
||||
- "--label=org.opencontainers.image.version={{ .Version }}"
|
||||
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
|
||||
- "--label=org.opencontainers.image.created={{ time \"2006-01-02T15:04:05Z07:00\" }}"
|
||||
image_templates:
|
||||
- "ghcr.io/opentffoundation/opentf:{{ .Version }}-arm64"
|
||||
|
||||
- use: buildx
|
||||
goarch: arm
|
||||
build_flag_templates:
|
||||
- "--pull"
|
||||
- "--platform=linux/arm"
|
||||
- "--label=org.opencontainers.image.title={{ .ProjectName }}"
|
||||
- "--label=org.opencontainers.image.vendor=OpenTF"
|
||||
- "--label=org.opencontainers.image.description=OpenTF {{ .Version }}"
|
||||
- "--label=org.opencontainers.image.url=https://github.com/opentffoundation/opentf"
|
||||
- "--label=org.opencontainers.image.documentation=https://github.com/opentffoundation/opentf/blob/main/README.md"
|
||||
- "--label=org.opencontainers.image.source=https://github.com/opentffoundation/opentf"
|
||||
- "--label=org.opencontainers.image.licenses=MPL-2.0"
|
||||
- "--label=org.opencontainers.image.version={{ .Version }}"
|
||||
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
|
||||
- "--label=org.opencontainers.image.created={{ time \"2006-01-02T15:04:05Z07:00\" }}"
|
||||
image_templates:
|
||||
- "ghcr.io/opentffoundation/opentf:{{ .Version }}-arm"
|
||||
|
||||
- use: buildx
|
||||
goarch: "386"
|
||||
build_flag_templates:
|
||||
- "--pull"
|
||||
- "--platform=linux/386"
|
||||
- "--label=org.opencontainers.image.title={{ .ProjectName }}"
|
||||
- "--label=org.opencontainers.image.vendor=OpenTF"
|
||||
- "--label=org.opencontainers.image.description=OpenTF {{ .Version }}"
|
||||
- "--label=org.opencontainers.image.url=https://github.com/opentffoundation/opentf"
|
||||
- "--label=org.opencontainers.image.documentation=https://github.com/opentffoundation/opentf/blob/main/README.md"
|
||||
- "--label=org.opencontainers.image.source=https://github.com/opentffoundation/opentf"
|
||||
- "--label=org.opencontainers.image.licenses=MPL-2.0"
|
||||
- "--label=org.opencontainers.image.version={{ .Version }}"
|
||||
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
|
||||
- "--label=org.opencontainers.image.created={{ time \"2006-01-02T15:04:05Z07:00\" }}"
|
||||
image_templates:
|
||||
- "ghcr.io/opentffoundation/opentf:{{ .Version }}-386"
|
||||
|
||||
docker_manifests:
|
||||
- name_template: ghcr.io/opentffoundation/opentf:v{{ .Version }}
|
||||
image_templates:
|
||||
- ghcr.io/opentffoundation/opentf:{{ .Version }}-amd64
|
||||
- ghcr.io/opentffoundation/opentf:{{ .Version }}-arm64
|
||||
- ghcr.io/opentffoundation/opentf:{{ .Version }}-arm
|
||||
- ghcr.io/opentffoundation/opentf:{{ .Version }}-386
|
||||
|
||||
- name_template: ghcr.io/opentffoundation/opentf:{{ .Major }}
|
||||
image_templates:
|
||||
- ghcr.io/opentffoundation/opentf:{{ .Version }}-amd64
|
||||
- ghcr.io/opentffoundation/opentf:{{ .Version }}-arm64
|
||||
- ghcr.io/opentffoundation/opentf:{{ .Version }}-arm
|
||||
- ghcr.io/opentffoundation/opentf:{{ .Version }}-386
|
||||
|
||||
- name_template: ghcr.io/opentffoundation/opentf:{{ .Major }}.{{ .Minor }}
|
||||
image_templates:
|
||||
- ghcr.io/opentffoundation/opentf:{{ .Version }}-amd64
|
||||
- ghcr.io/opentffoundation/opentf:{{ .Version }}-arm64
|
||||
- ghcr.io/opentffoundation/opentf:{{ .Version }}-arm
|
||||
- ghcr.io/opentffoundation/opentf:{{ .Version }}-386
|
||||
|
||||
- name_template: ghcr.io/opentffoundation/opentf:latest
|
||||
image_templates:
|
||||
- ghcr.io/opentffoundation/opentf:{{ .Version }}-amd64
|
||||
- ghcr.io/opentffoundation/opentf:{{ .Version }}-arm64
|
||||
- ghcr.io/opentffoundation/opentf:{{ .Version }}-arm
|
||||
- ghcr.io/opentffoundation/opentf:{{ .Version }}-386
|
||||
|
||||
checksum:
|
||||
name_template: "{{ .ProjectName }}_{{ .Version }}_SHA256SUMS"
|
||||
|
||||
snapshot:
|
||||
name_template: "{{ .Version }}-next"
|
||||
|
||||
changelog:
|
||||
use: github-native
|
||||
|
||||
release:
|
||||
draft: true
|
22
Dockerfile
22
Dockerfile
@ -1,26 +1,10 @@
|
||||
# Copyright (c) HashiCorp, Inc.
|
||||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
# This Dockerfile builds on golang:alpine by building OpenTF from source
|
||||
# using the current working directory.
|
||||
#
|
||||
# This produces a docker image that contains a working OpenTF binary along
|
||||
# with all of its source code. This is not what produces the official releases
|
||||
# in the "opentf" namespace on Dockerhub; those images include only
|
||||
# the officially-released binary from releases.hashicorp.com and are
|
||||
# built by the (closed-source) official release process.
|
||||
FROM alpine:3.18
|
||||
|
||||
FROM docker.mirror.hashicorp.services/golang:alpine
|
||||
LABEL maintainer="OpenTF Team <opentf@opentf.org>"
|
||||
|
||||
RUN apk add --no-cache git bash openssh
|
||||
COPY opentf /usr/local/bin/opentf
|
||||
|
||||
ENV TF_DEV=true
|
||||
ENV TF_RELEASE=1
|
||||
|
||||
WORKDIR $GOPATH/src/github.com/placeholderplaceholderplaceholder/opentf
|
||||
COPY . .
|
||||
RUN /bin/bash ./scripts/build.sh
|
||||
|
||||
WORKDIR $GOPATH
|
||||
ENTRYPOINT ["opentf"]
|
||||
ENTRYPOINT ["/usr/local/bin/opentf"]
|
||||
|
@ -32,7 +32,7 @@ fi
|
||||
# "IFS" environment variable, but the primary place we want to run this right
|
||||
# now is in our "quick checks" workflow and that _does_ have a reasonably
|
||||
# modern version of Bash.
|
||||
readarray -t target_files < <(git diff --name-only ${base_branch} --diff-filter=MA | grep "\.go" | grep -v ".pb.go" | grep -v ".go-version")
|
||||
readarray -t target_files < <(git diff --name-only ${base_branch} --diff-filter=MA | grep "\.go" | grep -v ".pb.go" | grep -v ".go-version" | grep -v ".goreleaser")
|
||||
|
||||
# NOTE: The above intentionally excludes .pb.go files because those are
|
||||
# generated by a tool (protoc-gen-go) which itself doesn't produce
|
||||
|
Loading…
Reference in New Issue
Block a user