diff --git a/.github/workflows/add-copyright-headers.yml b/.github/workflows/add-copyright-headers.yml deleted file mode 100644 index 397e4a41d..000000000 --- a/.github/workflows/add-copyright-headers.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: "Add Copyright Headers" - -on: - pull_request_target: - types: - - opened - - reopened - - synchronize - - ready_for_review - workflow_dispatch: {} - -jobs: - add-copyright-headers: - runs-on: ubuntu-latest - env: - HEAD_REF: ${{ github.event.pull_request.head.ref }} - permissions: - contents: write - steps: - - name: Checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - ref: ${{ github.event.pull_request.head.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - - name: Set git identity - run: |- - git config user.name "hashicorp-copywrite[bot]" - git config user.email "110428419+hashicorp-copywrite[bot]@users.noreply.github.com" - - name: Setup Copywrite tool - uses: hashicorp/setup-copywrite@867a1a2a064a0626db322392806428f7dc59cb3e # v1.1.2 - - name: Add headers using Copywrite tool - run: copywrite headers - - name: Check if there are any changes - id: get_changes - run: echo "changed=$(git status --porcelain | wc -l)" >> $GITHUB_OUTPUT - - name: Push changes - if: steps.get_changes.outputs.changed != 0 - run: |- - git add . - git commit -s -m "[COMPLIANCE] Add required copyright headers" - git push origin HEAD:$HEAD_REF diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 995cd242d..4cdf3224a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,77 +1,36 @@ 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 + pull_request: + push: + # run only against tags + tags: + - "*" jobs: - staging: - runs-on: ubuntu-latest + release: + runs-on: self-hosted 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 --rm-dist 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 }} diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 000000000..4b4ac8654 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,38 @@ +# 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 \ No newline at end of file diff --git a/internal/terraform/discovery/discovery_unix.go b/internal/terraform/discovery/discovery_unix.go index 1d01396a6..64173436f 100644 --- a/internal/terraform/discovery/discovery_unix.go +++ b/internal/terraform/discovery/discovery_unix.go @@ -6,4 +6,4 @@ package discovery -const executableName = "terraform" +const executableName = "tofu" diff --git a/internal/terraform/discovery/discovery_windows.go b/internal/terraform/discovery/discovery_windows.go index df907df69..4b0cf6a7f 100644 --- a/internal/terraform/discovery/discovery_windows.go +++ b/internal/terraform/discovery/discovery_windows.go @@ -3,4 +3,4 @@ package discovery -const executableName = "terraform.exe" +const executableName = "tofu.exe" diff --git a/version/VERSION b/version/VERSION index 6eb78516d..0d4d12494 100644 --- a/version/VERSION +++ b/version/VERSION @@ -1 +1 @@ -0.33.0-dev +0.1.0-dev