Skip to content

Commit

Permalink
Merge pull request #20 from intercloud/feat/IOPR-4188
Browse files Browse the repository at this point in the history
Feat/iopr 4188
  • Loading branch information
kfrapin authored Aug 26, 2024
2 parents 0c2a1c3 + 256313d commit c26b76f
Show file tree
Hide file tree
Showing 6 changed files with 204 additions and 0 deletions.
150 changes: 150 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
name: continuous-deployment

on:
push:
branches:
- main

env:
NODE_VERSION: 22.6.0
GO_VERSION: v1.22.0
GOLANGCI_LINT_VERSION: v1.59
GOPRIVATE: github.com/intercloud
TF_VERSION: 1.9.0
TF_MODULE_PATH: examples/autonomi

jobs:
markdown-lint:
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: set up node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: install markdownlint-cli
run: npm install -g markdownlint-cli
- name: markdownlint
run: markdownlint '**/*.md'

go-mod-tidy:
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: set up gitconfig
uses: ./.github/actions/setup-gitconfig
with:
ORG_GITHUB_TOKEN: ${{ secrets.ORG_GITHUB_TOKEN }}
- name: go mod tidy
run: go mod tidy

golangci-lint:
runs-on: ubuntu-latest
needs:
- go-mod-tidy
steps:
- name: checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: ${{ env.GOLANGCI_LINT_VERSION }}
args: './...'

go-test:
runs-on: ubuntu-latest
needs:
- golangci-lint
steps:
- name: checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: go test
run: go test ./... -v

release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: import gpg key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: go releaser check
uses: goreleaser/[email protected]
with:
version: latest
args: check
- name: go releaser
uses: goreleaser/[email protected]
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}

tf-validate:
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v4
- name: set up terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ env.TF_VERSION }}
- name: terraform init
working-directory: ${{ env.TF_MODULE_PATH }}
run: terraform init
- name: terraform validate
working-directory: ${{ env.TF_MODULE_PATH }}
run: terraform validate

tf-plan:
runs-on: ubuntu-latest
needs:
- tf-validate
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: set up terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ env.TF_VERSION }}
- name: terraform plan
working-directory: ${{ env.TF_MODULE_PATH }}
run: terraform plan -out=tfplan
env:
TF_VAR_pat_token: ${{ secrets.TF_VAR_PAT_TOKEN }}
TF_VAR_aws_account_id: ${{ secrets.TF_VAR_AWS_ACCOUNT_ID }}
48 changes: 48 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
version: 2
before:
hooks:
- 'go mod tidy'
builds:
- env:
- 'CGO_ENABLED=0'
ldflags:
- '-s -w -X version.Version={{.Version}} -X version.Prerelease={{.Prerelease}}'
goos:
- 'freebsd'
- 'windows'
- 'linux'
- 'darwin'
goarch:
- 'amd64'
- '386'
- 'arm'
- 'arm64'
ignore:
- goos: 'darwin'
goarch: '386'
binary: '{{ .ProjectName }}_v{{ .Version }}'
archives:
- format: 'zip'
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
snapshot:
version_template: '{{ .RawVersion }}-SNAPSHOT-{{ .ShortCommit }}'
checksum:
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
algorithm: 'sha256'
signs:
- artifacts: 'checksum'
args:
- '--batch'
- '-u'
- '{{ .Env.GPG_FINGERPRINT }}'
- '--output'
- '${signature}'
- '--detach-sign'
- '${artifact}'
changelog:
filters:
exclude:
- '^docs?'
release:
draft: true
prerelease: 'auto'
Empty file added examples/data-sources/.gitkeep
Empty file.
Empty file added examples/provider/.gitkeep
Empty file.
Empty file added examples/resources/.gitkeep
Empty file.
6 changes: 6 additions & 0 deletions terraform-registry-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"version": 1,
"metadata": {
"protocol_versions": ["6.0"]
}
}

0 comments on commit c26b76f

Please sign in to comment.