Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update version and add go releaser #3

Merged
merged 5 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
* @hashicorp/tf-editor-experience-engineers

# release configuration
/.release/ @hashicorp/release-engineering @hashicorp/tf-editor-experience-engineers
/.github/workflows/build.yml @hashicorp/release-engineering @hashicorp/tf-editor-experience-engineers
* @gamunu
41 changes: 0 additions & 41 deletions .github/workflows/add-copyright-headers.yml

This file was deleted.

90 changes: 24 additions & 66 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,77 +1,35 @@
name: Release

on:
workflow_dispatch:
inputs:
version:
description: 'Version'
required: true
type: string
sha:
description: 'SHA'
required: true
type: string
branch:
description: 'Branch'
required: true
type: choice
default: main
options:
- main
- pre-release
push:
# run only against tags
tags:
- "*"

jobs:
staging:
release:
runs-on: ubuntu-latest
steps:
- name: Setup bob
uses: hashicorp/action-setup-bob@v1
- uses: actions/checkout@v4
with:
github-token:
${{ secrets.BOB_GITHUB_TOKEN }}
- name: Promote to staging
env:
BOB_GITHUB_TOKEN: ${{ secrets.BOB_GITHUB_TOKEN }}
VERSION: ${{ github.event.inputs.version }}
SHA: ${{ github.event.inputs.sha }}
BRANCH: ${{ github.event.inputs.branch }}
ENVIRONMENT: staging
run: |
bob trigger-promotion \
--product-name=terraform-ls \
--environment=terraform-ls-oss \
--org=hashicorp \
--repo=terraform-ls \
--slack-channel=C02AGQXCAF5 \
--product-version=$VERSION \
--sha=$SHA \
--branch=$BRANCH \
$ENVIRONMENT
fetch-depth: 0 # this is important, otherwise it won't checkout the full tree (i.e. no previous tags)

production:
runs-on: ubuntu-latest
needs: staging
steps:
- name: Setup bob
uses: hashicorp/action-setup-bob@v1
- uses: actions/setup-go@v5
with:
go-version: stable

- uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- uses: sigstore/cosign-installer@v3.4.0 # installs cosign

- uses: goreleaser/goreleaser-action@v5 # run goreleaser
with:
github-token:
${{ secrets.BOB_GITHUB_TOKEN }}
- name: Promote to production
version: latest
args: release --clean
env:
BOB_GITHUB_TOKEN: ${{ secrets.BOB_GITHUB_TOKEN }}
VERSION: ${{ github.event.inputs.version }}
SHA: ${{ github.event.inputs.sha }}
BRANCH: ${{ github.event.inputs.branch }}
ENVIRONMENT: production
run: |
bob trigger-promotion \
--product-name=terraform-ls \
--environment=terraform-ls-oss \
--org=hashicorp \
--repo=terraform-ls \
--slack-channel=C02AGQXCAF5 \
--product-version=$VERSION \
--sha=$SHA \
--branch=$BRANCH \
$ENVIRONMENT
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41 changes: 41 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright (c) Gamunu Balagalla.
# SPDX-License-Identifier: MPL-2.0

# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com
# .goreleaser.yaml
project_name: opentofu-ls

before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- darwin
- freebsd
- windows

archives:
- format: binary

checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'

# The lines beneath this are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
2 changes: 1 addition & 1 deletion internal/terraform/discovery/discovery_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

package discovery

const executableName = "terraform"
const executableName = "tofu"
2 changes: 1 addition & 1 deletion internal/terraform/discovery/discovery_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

package discovery

const executableName = "terraform.exe"
const executableName = "tofu.exe"
2 changes: 1 addition & 1 deletion version/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.33.0-dev
0.1.0-dev
Loading