Skip to content

add option to use amend when updating state to reduce size (#46) #55

add option to use amend when updating state to reduce size (#46)

add option to use amend when updating state to reduce size (#46) #55

Workflow file for this run

on:
push:
tags:
- "v*"
name: Create Release
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
os: [linux, darwin, windows]
arch: [amd64, 386, arm64]
exclude:
- os: darwin
arch: 386
- os: windows
arch: arm64
steps:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: "1.23"
- name: Set RELEASE_VERSION
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV
- name: Set RELEASE_STRING
run: echo "RELEASE_STRING=v${RELEASE_VERSION}" >> $GITHUB_ENV
- name: Checkout Code
uses: actions/checkout@v3
- name: Add Windows Exe File Extension
if: matrix.os == 'windows'
run: |
echo "FILE_EXTENSION=.exe" >> $GITHUB_ENV
- name: Build Code
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
run: go build -ldflags="-X 'github.com/plumber-cd/terraform-backend-git/cmd.Version=${{ env.RELEASE_STRING }}'" -o build/terraform-backend-git-${{ matrix.os }}-${{ matrix.arch }}${{ env.FILE_EXTENSION }}
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: terraform-backend-git
path: build/terraform-backend-git-${{ matrix.os }}-${{ matrix.arch }}${{ env.FILE_EXTENSION }}
docker-image:
name: Build Docker Image
runs-on: ubuntu-latest
needs: build
steps:
- name: Set RELEASE_VERSION
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV
- name: Set RELEASE_STRING
run: echo "RELEASE_STRING=v${RELEASE_VERSION}" >> $GITHUB_ENV
- name: Checkout Code
uses: actions/checkout@v3
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
build-args: |
RELEASE_STRING=${{ env.RELEASE_STRING }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
release:
name: Draft Release
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: terraform-backend-git
path: terraform-backend-git
- name: Generate SHA256SUMS
run: |
cd terraform-backend-git && sha256sum * > SHA256SUMS
- name: List Artifacts
run: |
echo "ARTIFACTS=$(echo terraform-backend-git/*)" >> $GITHUB_ENV
- name: Release
uses: docker://antonyurchenko/git-release:v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DRAFT_RELEASE: "true"
PRE_RELEASE: "false"
CHANGELOG_FILE: "CHANGELOG.md"
ALLOW_EMPTY_CHANGELOG: "false"
with:
args: |
${{ env.ARTIFACTS }}