Skip to content

Commit

Permalink
Modify GH Actions (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
zulh-civo authored Sep 30, 2021
1 parent 5ab9131 commit 14e7970
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 15 deletions.
5 changes: 5 additions & 0 deletions .auto-changelog-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"template": ".auto-changelog-template.hbs",
"commitLimit": 100,
"ignoreCommitPattern": "Update docs and CHANGELOG.md"
}
18 changes: 18 additions & 0 deletions .auto-changelog-template.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{#each releases}}

## [{{title}}](https://github.com/civo/terraform-provider-civo/releases/tag/{{title}}) ({{niceDate}})

{{#if merges}}
### Merged
{{#each merges}}
- [#{{id}}]({{href}}) - {{message}}
{{/each}}
{{/if}}

{{#if commits}}
### Commits
{{#each commits}}
- [{{shorthash}}]({{href}}) - {{subject}}
{{/each}}
{{/if}}
{{/each}}
63 changes: 48 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,67 @@
name: goreleaser
name: Release

on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
newVersionTag:
description: 'New version tag (e.g. v0.10.11)'
required: true

jobs:
goreleaser:
release:
runs-on: ubuntu-latest
steps:
-
name: Checkout
- name: Checkout
uses: actions/checkout@v2
-
name: Unshallow

- name: Unshallow
run: git fetch --prune --unshallow
-
name: Set up Go

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16.x
-
name: Import GPG key

- name: Install and run tfplugindocs CLI
run: |
mkdir downloads
cd downloads
wget https://github.com/hashicorp/terraform-plugin-docs/releases/download/v0.5.0/tfplugindocs_0.5.0_linux_amd64.zip
unzip tfplugindocs_0.5.0_linux_amd64.zip
cd ..
mv downloads/tfplugindocs .
./tfplugindocs generate
rm -rf ./tfplugindocs downloads
- name: Install and run auto-changelog CLI
run: |
npm i -g auto-changelog@2.3.0
auto-changelog --config=.auto-changelog-config --latest-version=${{ github.event.inputs.newVersionTag }}
- name: Setup Git config
run: |
git config user.name "GitHub Actions"
git config user.email "<>"
- name: Add and commit generated files
run: |
git add .
git commit -m "Update docs and CHANGELOG.md"
- name: Create a tag and push
run: |
git pull origin master
git tag -a ${{ github.event.inputs.newVersionTag }} -m ""
git push origin master --follow-tags
- name: Import GPG key
id: import_gpg
uses: paultyng/ghaction-import-gpg@v2.1.0
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
-
name: Run GoReleaser

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
args: release --rm-dist
Expand Down

0 comments on commit 14e7970

Please sign in to comment.