generated from QubitPi/packer-plugin-scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5b089cb
Showing
51 changed files
with
3,158 additions
and
0 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,7 @@ | ||
project { | ||
license = "MPL-2.0" | ||
copyright_year = 2013 | ||
header_ignore = [ | ||
".goreleaser.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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "gomod" # See documentation for possible values | ||
directory: "/" # Location of package manifests | ||
schedule: | ||
interval: "daily" | ||
allow: | ||
- dependency-name: "github.com/hashicorp/packer-plugin-sdk" |
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,58 @@ | ||
# Copyright Jiaqi Liu | ||
--- | ||
name: CI/CD | ||
|
||
"on": | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
test-example: | ||
uses: ./.github/workflows/test-plugin-example.yml | ||
|
||
# referencing release.yml - get-go-version | ||
get-go-version: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
go-version: ${{ steps.get-go-version.outputs.go-version }} | ||
steps: | ||
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | ||
- name: 'Determine Go version' | ||
id: get-go-version | ||
run: | | ||
echo "Found Go $(cat .go-version)" | ||
echo "go-version=$(cat .go-version)" >> $GITHUB_OUTPUT | ||
tests: | ||
name: Go Tests | ||
needs: [test-example, get-go-version] | ||
outputs: | ||
outcome: ${{ job.status }} | ||
continue-on-error: true | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 | ||
with: | ||
go-version: ${{ needs.get-go-version.outputs.go-version }} | ||
- run: | | ||
make build | ||
make test | ||
release: | ||
needs: [tests] | ||
if: ${{ github.ref == 'refs/heads/master' && github.repository != 'QubitPi/hashicorp-packer-plugin-scaffolding' }} | ||
uses: ./.github/workflows/release.yml | ||
secrets: inherit | ||
|
||
slack-notification: | ||
name: Send Slack Notification | ||
if: github.ref != 'refs/heads/master' | ||
needs: tests | ||
uses: QubitPi/hashicorp-aws/.github/workflows/slack-notification.yml@master | ||
with: | ||
job-status: ${{ needs.tests.outputs.outcome }} | ||
secrets: | ||
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }} |
50 changes: 50 additions & 0 deletions
50
.github/workflows/notify-integration-release-via-manual.yaml
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,50 @@ | ||
# Manual release workflow is used for deploying documentation updates | ||
# on the specified branch without making an official plugin release. | ||
name: Notify Integration Release (Manual) | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: "The release version (semver)" | ||
default: 1.0.0 | ||
required: false | ||
branch: | ||
description: "A branch or SHA" | ||
default: 'main' | ||
required: false | ||
jobs: | ||
notify-release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout this repo | ||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | ||
with: | ||
ref: ${{ github.event.inputs.branch }} | ||
# Ensure that Docs are Compiled | ||
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 | ||
- shell: bash | ||
run: make generate | ||
- shell: bash | ||
run: | | ||
if [[ -z "$(git status -s)" ]]; then | ||
echo "OK" | ||
else | ||
echo "Docs have been updated, but the compiled docs have not been committed." | ||
echo "Run 'make generate', and commit the result to resolve this error." | ||
exit 1 | ||
fi | ||
# Perform the Release | ||
- name: Checkout integration-release-action | ||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | ||
with: | ||
repository: hashicorp/integration-release-action | ||
path: ./integration-release-action | ||
- name: Notify Release | ||
uses: ./integration-release-action | ||
with: | ||
# The integration identifier will be used by the Packer team to register the integration | ||
# the expected format is packer/<GitHub Org Name>/<plugin-name> | ||
integration_identifier: "packer/hashicorp/scaffolding" | ||
release_version: ${{ github.event.inputs.version }} | ||
release_sha: ${{ github.event.inputs.branch }} | ||
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 @@ | ||
name: Notify Integration Release (Tag) | ||
on: | ||
push: | ||
tags: | ||
- '*.*.*' # Proper releases | ||
jobs: | ||
strip-version: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
packer-version: ${{ steps.strip.outputs.packer-version }} | ||
steps: | ||
- name: Strip leading v from version tag | ||
id: strip | ||
env: | ||
REF: ${{ github.ref_name }} | ||
run: | | ||
echo "packer-version=$(echo "$REF" | sed -E 's/v?([0-9]+\.[0-9]+\.[0-9]+)/\1/')" >> "$GITHUB_OUTPUT" | ||
notify-release: | ||
needs: | ||
- strip-version | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout this repo | ||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | ||
with: | ||
ref: ${{ github.ref }} | ||
# Ensure that Docs are Compiled | ||
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 | ||
- shell: bash | ||
run: make generate | ||
- shell: bash | ||
run: | | ||
if [[ -z "$(git status -s)" ]]; then | ||
echo "OK" | ||
else | ||
echo "Docs have been updated, but the compiled docs have not been committed." | ||
echo "Run 'make generate', and commit the result to resolve this error." | ||
exit 1 | ||
fi | ||
# Perform the Release | ||
- name: Checkout integration-release-action | ||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | ||
with: | ||
repository: hashicorp/integration-release-action | ||
path: ./integration-release-action | ||
- name: Notify Release | ||
uses: ./integration-release-action | ||
with: | ||
# The integration identifier will be used by the Packer team to register the integration | ||
# the expected format is packer/<GitHub Org Name>/<plugin-name> | ||
integration_identifier: "packer/hashicorp/scaffolding" | ||
release_version: ${{ needs.strip-version.outputs.packer-version }} | ||
release_sha: ${{ github.ref }} | ||
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,84 @@ | ||
# This GitHub action can publish assets for release when a tag is created. | ||
# Currently its setup to run on any tag that matches the pattern "v*" (ie. v0.1.0). | ||
# | ||
# This uses an action (hashicorp/ghaction-import-gpg) that assumes you set your | ||
# private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `GPG_PASSPHRASE` | ||
# secret. See https://qubitpi.github.io/hashicorp-packer/packer/docs/plugins/creation#creating-a-github-release for more | ||
# details on how to create `GPG_PRIVATE_KEY` and `GPG_PASSPHRASE`. If one would rather own their own GPG handling, | ||
# please fork this action or use an alternative one for key handling. | ||
# | ||
# One will need to pass the `--batch` flag to `gpg` in their signing step | ||
# in `goreleaser` to indicate this is being used in a non-interactive mode. | ||
# | ||
name: release | ||
|
||
on: | ||
workflow_call: | ||
|
||
permissions: | ||
contents: write | ||
packages: read | ||
|
||
jobs: | ||
push-release-tag: | ||
uses: QubitPi/hashicorp-aws/.github/workflows/version-bump.yml@master | ||
with: | ||
user: QubitPi | ||
email: jack20220723@gmail.com | ||
|
||
get-go-version: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
go-version: ${{ steps.get-go-version.outputs.go-version }} | ||
steps: | ||
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | ||
- name: 'Determine Go version' | ||
id: get-go-version | ||
run: | | ||
echo "Found Go $(cat .go-version)" | ||
echo "go-version=$(cat .go-version)" >> $GITHUB_OUTPUT | ||
goreleaser: | ||
needs: | ||
- push-release-tag | ||
- get-go-version | ||
outputs: | ||
outcome: ${{ job.status }} | ||
continue-on-error: true | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | ||
- name: Unshallow | ||
run: git fetch --prune --unshallow | ||
- name: Set up Go | ||
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 | ||
with: | ||
go-version: ${{ needs.get-go-version.outputs.go-version }} | ||
- name: Describe plugin | ||
id: plugin_describe | ||
run: echo "api_version=$(go run . describe | jq -r '.api_version')" >> $GITHUB_OUTPUT | ||
- name: Import GPG key | ||
id: import_gpg | ||
uses: crazy-max/ghaction-import-gpg@111c56156bcc6918c056dbef52164cfa583dc549 # v5.2.0 | ||
with: | ||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | ||
passphrase: ${{ secrets.GPG_PASSPHRASE }} | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@f82d6c1c344bcacabba2c841718984797f664a6b # v4.2.0 | ||
with: | ||
version: latest | ||
args: release --clean --timeout 120m | ||
env: | ||
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
API_VERSION: ${{ steps.plugin_describe.outputs.api_version }} | ||
|
||
slack-notification: | ||
name: Send Slack Notification | ||
needs: goreleaser | ||
uses: QubitPi/hashicorp-aws/.github/workflows/slack-notification.yml@master | ||
with: | ||
job-status: ${{ needs.goreleaser.outputs.outcome }} | ||
secrets: | ||
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }} |
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,59 @@ | ||
# This is a manually triggered action workflow. | ||
# It uses Packer at latest version to init, validate and build | ||
# an example configuration in a folder. | ||
# This action is compatible with Packer v1.7.0 or later. | ||
name: test plugin example | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
logs: | ||
description: 'Set 1 to activate full logs' | ||
required: false | ||
default: '0' | ||
type: string | ||
folder: | ||
description: 'Example folder' | ||
required: false | ||
default: './example' | ||
type: string | ||
workflow_dispatch: | ||
inputs: | ||
logs: | ||
description: 'Set 1 to activate full logs' | ||
required: false | ||
default: '0' | ||
folder: | ||
description: 'Example folder' | ||
required: false | ||
default: './example' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
name: init and build example | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | ||
|
||
- name: Init | ||
uses: hashicorp/packer-github-actions@master | ||
with: | ||
working_directory: ${{ inputs.folder }} | ||
command: init | ||
|
||
- name: Validate | ||
uses: hashicorp/packer-github-actions@master | ||
with: | ||
working_directory: ${{ inputs.folder }} | ||
command: validate | ||
env: | ||
PACKER_LOG: ${{ inputs.logs }} | ||
|
||
- name: Build | ||
uses: hashicorp/packer-github-actions@master | ||
with: | ||
working_directory: ${{ inputs.folder }} | ||
command: build | ||
env: | ||
PACKER_LOG: ${{ inputs.logs }} |
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,9 @@ | ||
main | ||
packer-plugin-scaffolding | ||
**/packer_log*.txt | ||
**/git_*test.pkr.hcl | ||
crash.log | ||
|
||
dist/* | ||
.docs/* | ||
docs.zip |
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,2 @@ | ||
1.20.11 | ||
|
Oops, something went wrong.