-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from smutel/ImproveReleaseProcess
Improve release process
- Loading branch information
Showing
7 changed files
with
128 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
name: Master | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
LintAndBuild: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
go: [ '1.15.x' ] | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
||
- name: Unshallow | ||
run: git fetch --prune --unshallow | ||
|
||
- name: Lint | ||
uses: reviewdog/[email protected] | ||
with: | ||
github_token: ${{ secrets.github_token }} | ||
golangci_lint_flags: "--config=.golangci.yml" | ||
|
||
- name: Setup env | ||
run: | | ||
echo "GOPATH=$(dirname $GITHUB_WORKSPACE)" >> $GITHUB_ENV | ||
echo "$(dirname $GITHUB_WORKSPACE)/bin" >> $GITHUB_PATH | ||
mkdir -p "$(dirname $GITHUB_WORKSPACE)/src/github.com/smutel" | ||
ln -sf "$GITHUB_WORKSPACE/" "$(dirname $GITHUB_WORKSPACE)/src/github.com/smutel/terraform-provider-netbox" | ||
shell: bash | ||
|
||
- name: Go installation | ||
uses: actions/[email protected] | ||
with: | ||
go-version: ${{ matrix.go }} | ||
|
||
- name: Build | ||
run: | | ||
cd "$(dirname $GITHUB_WORKSPACE)/src/github.com/smutel/terraform-provider-netbox" | ||
make build | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,13 +16,13 @@ jobs: | |
go: [ '1.15.x' ] | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected].3 | ||
uses: actions/[email protected].4 | ||
|
||
- name: Unshallow | ||
run: git fetch --prune --unshallow | ||
|
||
- name: Lint | ||
uses: reviewdog/[email protected].0 | ||
uses: reviewdog/[email protected].1 | ||
with: | ||
github_token: ${{ secrets.github_token }} | ||
golangci_lint_flags: "--config=.golangci.yml" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ jobs: | |
go: [ '1.15.x' ] | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected].3 | ||
uses: actions/[email protected].4 | ||
|
||
- name: Unshallow | ||
run: git fetch --prune --unshallow | ||
|
@@ -27,16 +27,21 @@ jobs: | |
|
||
- name: Import GPG key | ||
id: import_gpg | ||
uses: crazy-max/[email protected].1 | ||
uses: crazy-max/[email protected].2 | ||
with: | ||
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} | ||
passphrase: ${{ secrets.PASSPHRASE }} | ||
- | ||
name: Run GoReleaser | ||
uses: goreleaser/[email protected] | ||
|
||
- name: Generate CHANGELOG for this version | ||
run: ./utils/getChangelogRelease CHANGELOG.md $TAG > RELEASE_CHANGELOG.md | ||
env: | ||
TAG: ${{ github.event.release.tag_name }} | ||
|
||
- name: Run GoReleaser | ||
uses: goreleaser/[email protected] | ||
with: | ||
version: latest | ||
args: release --rm-dist | ||
args: release --rm-dist --release-notes=RELEASE_CHANGELOG.md | ||
env: | ||
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Visit https://goreleaser.com for documentation on how to customize this | ||
# behavior. | ||
before: | ||
hooks: | ||
# this is just an example and not a requirement for provider building/publishing | ||
- go mod tidy | ||
builds: | ||
- env: | ||
# goreleaser does not work with CGO, it could also complicate | ||
# usage by users in CI/CD systems like Terraform Cloud where | ||
# they are unable to install libraries. | ||
- CGO_ENABLED=0 | ||
mod_timestamp: '{{ .CommitTimestamp }}' | ||
flags: | ||
- -trimpath | ||
ldflags: | ||
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}' | ||
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 }}' | ||
checksum: | ||
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS' | ||
algorithm: sha256 | ||
signs: | ||
- artifacts: checksum | ||
args: | ||
# if you are using this is a GitHub action or some other automated pipeline, you | ||
# need to pass the batch flag to indicate its not interactive. | ||
- "--batch" | ||
- "--local-user" | ||
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key | ||
- "--output" | ||
- "${signature}" | ||
- "--detach-sign" | ||
- "${artifact}" | ||
release: | ||
# Visit your project's GitHub Releases page to publish this release. | ||
draft: true | ||
changelog: | ||
skip: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "terraform-provider-netbox", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Terraform provider for Netbox" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
CHANGELOG_FILE="$1" | ||
VERSION="$2" | ||
|
||
if [[ ${VERSION} =~ v* ]]; then | ||
VERSION=${VERSION:1} | ||
fi | ||
|
||
START=$(grep -n "## \[${VERSION}\]" "${CHANGELOG_FILE}" | cut -d : -f 1) | ||
END_VERSION=$(grep "## \[" "${CHANGELOG_FILE}" | cut -d"[" -f2 | cut -d"]" -f1 | grep -v 1.1.0 | head -1) | ||
END=$(grep -n "## \[${END_VERSION}\]" ${CHANGELOG_FILE} | cut -d : -f 1) | ||
cat "${CHANGELOG_FILE}" | tail -n +"$((START + 3))" | head -n "$((END - START - 4))" |