Skip to content

Fix import script github action #5

Fix import script github action

Fix import script github action #5

name: Build and Release Import Script
on:
push:
tags:
- 'import/v*'
pull_request:
branches:
- main
permissions:
contents: write
jobs:
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: 'go.mod'
cache: true
- run: go mod download
- run: go build -v -o terraform-import-script ./import/import_script.go
- name: Upload Terraform import script artifact
uses: actions/upload-artifact@v3
with:
name: terraform-import-script
path: terraform-import-script
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: 'go.mod'
cache: true
- run: go fmt ./import/import_script.go
- run: go vet ./import/import_script.go
- run: make validate-fmt
goreleaser:
needs: [build, lint]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: 'go.mod'
cache: true
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v5
id: import_gpg
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --clean --config .goreleaser.import.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
- name: Upload GoReleaser artifacts
uses: actions/upload-artifact@v3
with:
name: goreleaser-artifacts
path: dist/*