Skip to content

Commit b5b5f97

Browse files
authored
Fix script error (#134)
1 parent 532f085 commit b5b5f97

File tree

3 files changed

+39
-23
lines changed

3 files changed

+39
-23
lines changed

.github/workflows/build-release-import-script.yml

+13-9
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Build and Release Import Script
33
on:
44
push:
55
tags:
6-
- 'import-v*'
6+
- 'import/v*'
77

88
permissions:
99
contents: write
@@ -20,7 +20,12 @@ jobs:
2020
go-version-file: 'go.mod'
2121
cache: true
2222
- run: go mod download
23-
- run: go build -v -o import ./import/import_script.go
23+
- run: go build -v -o terraform-import-script ./import/import_script.go
24+
- name: Upload Terraform import script artifact
25+
uses: actions/upload-artifact@v3
26+
with:
27+
name: terraform-import-script
28+
path: terraform-import-script
2429

2530
lint:
2631
name: Lint
@@ -36,30 +41,29 @@ jobs:
3641
- run: make validate-fmt
3742

3843
goreleaser:
44+
needs: [build, lint]
3945
runs-on: ubuntu-latest
4046
steps:
4147
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
42-
with:
43-
fetch-depth: 0
4448
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
4549
with:
4650
go-version-file: 'go.mod'
4751
cache: true
4852
- name: Import GPG key
49-
uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # v6.1.0
53+
uses: crazy-max/ghaction-import-gpg@v5
5054
id: import_gpg
5155
with:
5256
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
5357
passphrase: ${{ secrets.PASSPHRASE }}
5458
- name: Run GoReleaser
5559
uses: goreleaser/goreleaser-action@5742e2a039330cbb23ebf35f046f814d4c6ff811 # v5.1.0
5660
with:
57-
args: release --clean --config .goreleaser.import.yml # Use the import-specific config
61+
args: release --clean --config .goreleaser.import.yml
5862
env:
5963
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6064
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
61-
- name: Upload Terraform import script artifact
65+
- name: Upload GoReleaser artifacts
6266
uses: actions/upload-artifact@v3
6367
with:
64-
name: import
65-
path: dist/import*
68+
name: goreleaser-artifacts
69+
path: dist/*

.goreleaser.import.yml

+22-12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
project_name: terraform-import-script
22

33
builds:
4-
- main: ./import/import.go
4+
- main: ./import/import_script.go
55
binary: terraform-import-script
66
goos:
77
- linux
@@ -10,11 +10,15 @@ builds:
1010
goarch:
1111
- amd64
1212
- arm64
13+
env:
14+
- CGO_ENABLED=0
15+
ldflags:
16+
- '-s -w'
1317

1418
archives:
1519
- format: tar.gz
1620
name_template: >-
17-
{{ .ProjectName }}_
21+
{{ .ProjectName }}_{{ .Version }}_
1822
{{- title .Os }}_
1923
{{- if eq .Arch "amd64" }}x86_64
2024
{{- else if eq .Arch "386" }}i386
@@ -23,26 +27,32 @@ archives:
2327
- goos: windows
2428
format: zip
2529

26-
changelog:
27-
sort: asc
28-
filters:
29-
exclude:
30-
- '^docs:'
31-
- '^test:'
30+
checksum:
31+
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
32+
algorithm: sha256
3233

3334
signs:
34-
- cmd: gpg
35+
- artifacts: checksum
3536
args:
37+
- "--batch"
38+
- "--local-user"
39+
- "{{ .Env.GPG_FINGERPRINT }}"
3640
- "--output"
3741
- "${signature}"
3842
- "--detach-sign"
3943
- "${artifact}"
40-
artifacts: checksum
4144

42-
# Customize the release name to differentiate it from your main project releases
45+
changelog:
46+
sort: asc
47+
filters:
48+
exclude:
49+
- '^docs:'
50+
- '^test:'
51+
4352
release:
4453
name_template: "Terraform Import Script {{.Tag}}"
4554
header: |
4655
# Terraform Import Script Release {{.Tag}}
4756
48-
This release contains the Terraform import script, a standalone tool for importing resources into Terraform.
57+
This release contains the Terraform import script, a standalone tool for importing resources into Terraform.
58+
prerelease: auto

import/import_script.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,10 @@ provider "astro" {
161161
}(resource)
162162
}
163163

164-
wg.Wait()
165-
close(results)
164+
go func() {
165+
wg.Wait()
166+
close(results)
167+
}()
166168

167169
var allResults []HandlerResult
168170
var deploymentImportString string

0 commit comments

Comments
 (0)