Skip to content

Commit

Permalink
πŸš€ Setup Release Process
Browse files Browse the repository at this point in the history
πŸ”¨ Automate feed generation

πŸ”¨ Fix artifacts filenames

πŸ”¨ Fix release not happening

πŸ”¨ Fix release file name

πŸ”¨ Fix release configuration

πŸ”¨ Fix exclude files regex in release

Create go.yml

Create release.yml

πŸ”¨ Fix curl failing in github actions

πŸ”¨ Fix curl failing in github actions

πŸ”¨ Fix goreleaser failing

πŸ”¨ Fix goreleaser failing

πŸ”¨ Run GitHub actions on PRs and tag push

πŸ”¨ Fix goreleaser failing because no GITHUB_TOKEN

πŸ”¨ Add porter to PATH in goreleaser

πŸ”¨ Send porter path from env

πŸ”¨ Add feed automation steps

πŸ”¨ Fix feed upload failing

πŸ”¨ Fix feed upload failing

πŸ”¨ Add feed delete step

πŸ”¨ Fix typo

πŸ› Dont on build when tag is feed

πŸ› Skip feed generation for non tag events

πŸ”¨ Seperate workflows for release and test

πŸ› Fix not having releases throwing an error

πŸ“ Add README.md

πŸ”¨ Upgrade delete-tag-and-release to get fixes
  • Loading branch information
dev-drprasad committed May 20, 2020
1 parent efd772d commit c77108c
Show file tree
Hide file tree
Showing 9 changed files with 200 additions and 3 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Release

on:
push:
tags:
- "v*"

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.13
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Unshallow
run: git fetch --prune --unshallow

- name: Install Porter
run: |
curl -fsSLo porter "https://cdn.porter.sh/v0.26.2-beta.1/porter-linux-amd64"
chmod +x porter
- name: GoReleaser Action
if: ${{ !startsWith(github.ref, 'refs/tags/feed') }}
uses: goreleaser/[email protected]
with:
version: latest
args: release --rm-dist --skip-validate --skip-sign
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PORTERPATH: ./porter
- name: Delete Existing Feed
uses: dev-drprasad/[email protected]
with:
tag_name: feed
delete_release: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Prepare Feed
id: prepare_feed
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: feed
release_name: feed
draft: false
prerelease: false
- name: Upload Feed
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.prepare_feed.outputs.upload_url }}
asset_path: ./dist/atom.xml
asset_name: atom.xml
asset_content_type: application/xml
37 changes: 37 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Test

on:
pull_request:
push:
branches: [master]

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.13
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Unshallow
run: git fetch --prune --unshallow

- name: Install Porter
run: |
curl -fsSLo porter "https://cdn.porter.sh/v0.26.2-beta.1/porter-linux-amd64"
chmod +x porter
- name: GoReleaser Action
uses: goreleaser/[email protected]
with:
version: latest
args: release --rm-dist --skip-validate --skip-sign --snapshot
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PORTERPATH: ./porter
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/bin
/dist
.DS_Store
.test/

32 changes: 32 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
env:
- GO111MODULE=on
before:
hooks:
- go mod download
builds:
- env:
- CGO_ENABLED=0
ldflags:
- -w -X github.com/dev-drprasad/porter-hashicorp-plugins/pkg.Version=v{{.Version}} -X github.com/dev-drprasad/porter-hashicorp-plugins/pkg.Commit={{.ShortCommit}}
goos:
- darwin
# - windows
- linux
goarch:
- amd64
hooks:
post: "./build-posthook.sh {{.Env.PORTERPATH}} v{{.Version}}"

archives:
- format: binary
name_template: "hashicorp-{{ .Os }}-{{ .Arch }}"

release:
extra_files:
- glob: dist/atom.xml

changelog:
sort: asc
filters:
exclude:
- "^[πŸ”¨βͺβœ…πŸ“πŸ”€].*"
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ VERSION ?= $(shell git describe --tags 2> /dev/null || echo v0)
GO = GO111MODULE=on go
LDFLAGS = -w -X $(WORKDIR)/pkg.Version=$(VERSION) -X $(WORKDIR)/pkg.Commit=$(COMMIT)
XBUILD = CGO_ENABLED=0 $(GO) build -a -tags netgo -ldflags '$(LDFLAGS)'
BINDIR = bin
BINDIR = dist

CLIENT_PLATFORM ?= $(shell go env GOOS)
CLIENT_ARCH ?= $(shell go env GOARCH)
Expand Down Expand Up @@ -50,4 +50,4 @@ install:
install $(BINDIR)/$(PLUGIN)$(FILE_EXT) $(PORTER_HOME)/plugins/$(PLUGIN)$(FILE_EXT)

clean:
-rm -fr bin/
-rm -fr $(BINDIR)
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
### Porter's HashiCorp Plugins

supports only `secrets` interface

Install:

```
porter plugin install hashicorp --feed-url https://github.com/dev-drprasad/porter-hashicorp-plugins/releases/download/feed/atom.xml
```

update `config.yml`:

```
default-secrets = "mysecrets"
[[secrets]]
name = "mysecrets"
plugin = "hashicorp.vault"
[secrets.config]
vault_addr = "http://vault.example.com:7500"
path_prefix = "kv"
vault_token = "token"
```
25 changes: 25 additions & 0 deletions atom-template.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<feed xmlns="http://www.w3.org/2005/Atom">
<id>https://github.com/dev-drprasad/porter-hashicorp-plugins</id>
<title>Porter's Hashicorp Plugins</title>
<updated>{{Updated}}</updated>
<link rel="self" href="https://github.com/dev-drprasad/porter-hashicorp-plugins/releases/download/latest/atom.xml"/>
<author>
<name>REDDY PRASAD (@dev-drprasad)</name>
<uri>https://github.com/dev-drprasad</uri>
</author>
{{#Mixins}}
<category term="{{.}}"/>
{{/Mixins}}
{{#Entries}}
<entry>
<id>porter-hashicorp-plugins ({{Version}})</id>
<title>{{Mixin}} @ {{Version}}</title>
<updated>{{Updated}}</updated>
<category term="{{Mixin}}"/>
<content>{{Version}}</content>
{{#Files}}
<link rel="download" href="https://github.com/dev-drprasad/porter-hashicorp-plugins/releases/download/{{Version}}/{{File}}" />
{{/Files}}
</entry>
{{/Entries}}
</feed>
12 changes: 12 additions & 0 deletions build-posthook.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

EXECUTABLE=${1:-porter}

mkdir dist/$2

cp 'dist/porter-hashicorp-plugins_darwin_amd64/porter-hashicorp-plugins' "dist/$2/hashicorp-darwin-amd64"
cp "dist/porter-hashicorp-plugins_linux_amd64/porter-hashicorp-plugins" "dist/$2/hashicorp-linux-amd64"
# cp "dist/porter-hashicorp-plugins_windows_amd64/porter-hashicorp-plugins.exe" "dist/$2/porter-hashicorp-plugins-windows-amd64.exe"

$EXECUTABLE mixin feed generate -d dist/$2 -f dist/atom.xml -t atom-template.xml
exit 0
2 changes: 1 addition & 1 deletion pkg/vault/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (s *Store) Connect() error {
return errors.Wrapf(err, "could not connect to vault server with address %s", s.config.VaultAddr)
}
s.client = client
s.client.SetToken("s.BRGSWg7rIGxfq4ZsBQiCZ8Ki")
s.client.SetToken(s.config.VaultToken)

return nil
}
Expand Down

0 comments on commit c77108c

Please sign in to comment.