generated from omegion/go-cli-template
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* I-11 | Change repo name * - fix GH action * - refactor codebase * - manual trigger * - fix GH action * - fix lints
- Loading branch information
Hakan
authored
Apr 8, 2022
1 parent
436f104
commit be84a98
Showing
20 changed files
with
922 additions
and
69 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,33 @@ | ||
## Installation | ||
|
||
You can use `go` to build S3 Secrets Manager locally with: | ||
|
||
```shell | ||
go install github.com/omegion/argocd-actions | ||
``` | ||
|
||
Or, you can use the usual commands to install or upgrade: | ||
|
||
On OS X | ||
|
||
```shell | ||
curl -L https://github.com/omegion/argocd-actions/releases/download/{{.Env.VERSION}}/argocd-actions-darwin-amd64 >/usr/local/bin/argocd-actions | ||
&& \ | ||
chmod +x /usr/local/bin/argocd-actions | ||
``` | ||
|
||
On Linux | ||
|
||
```shell | ||
curl -L https://github.com/omegion/argocd-actions/releases/download/{{.Env.VERSION}}/argocd-actions-linux-amd64 >/usr/local/bin/argocd-actions | ||
&& \ | ||
chmod +x /tmp/argocd-actions && \ | ||
sudo cp /tmp/argocd-actions /usr/local/bin/argocd-actions | ||
``` | ||
|
||
Otherwise, download one of the releases from the [release page](https://github.com/omegion/argocd-actions/releases/) | ||
directly. | ||
|
||
See the install [docs](https://argocd-actions.omegion.dev) for more install options and instructions. | ||
|
||
## Changelog |
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,108 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
jobs: | ||
push_to_registry: | ||
name: Push Docker image to GitHub | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: Import Secrets | ||
id: secrets | ||
uses: hashicorp/[email protected] | ||
with: | ||
url: ${{ secrets.VAULT_ADDR }} | ||
method: github | ||
githubToken: ${{ secrets.GT_VAULT_AUTH_TOKEN }} | ||
secrets: | | ||
github/data/token registry_write | GITHUB_REGISTRY_TOKEN ; | ||
- name: Get the version | ||
run: | | ||
VERSION=$(echo $GITHUB_REF | cut -d / -f 3) | ||
echo "VERSION=$VERSION" >> $GITHUB_ENV | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Login to GitHub | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ steps.secrets.outputs.GITHUB_REGISTRY_TOKEN }} | ||
|
||
- name: Build and push to GitHub | ||
id: github_build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: ./ | ||
file: ./Dockerfile | ||
push: true | ||
tags: ghcr.io/omegion/argocd-actions:latest,ghcr.io/omegion/argocd-actions:${{env.VERSION}} | ||
platforms: linux/amd64,linux/arm64 | ||
|
||
release: | ||
name: Create Release | ||
runs-on: 'ubuntu-latest' | ||
strategy: | ||
matrix: | ||
# List of GOOS and GOARCH pairs from `go tool dist list` | ||
goosarch: | ||
- 'darwin/amd64' | ||
- 'darwin/arm64' | ||
- 'linux/amd64' | ||
- 'linux/arm64' | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Get the version | ||
run: | | ||
VERSION=$(echo $GITHUB_REF | cut -d / -f 3) | ||
echo "VERSION=$VERSION" >> $GITHUB_ENV | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: '1.17' | ||
- name: Get OS and arch info | ||
run: | | ||
GOOSARCH=${{matrix.goosarch}} | ||
GOOS=${GOOSARCH%/*} | ||
GOARCH=${GOOSARCH#*/} | ||
BINARY_NAME=argocd-actions-$GOOS-$GOARCH | ||
VERSION=$(echo $GITHUB_REF | cut -d / -f 3) | ||
echo "BINARY_NAME=$BINARY_NAME" >> $GITHUB_ENV | ||
echo "GOOS=$GOOS" >> $GITHUB_ENV | ||
echo "GOARCH=$GOARCH" >> $GITHUB_ENV | ||
echo "VERSION=$VERSION" >> $GITHUB_ENV | ||
- name: Build | ||
run: | | ||
make build TARGETOS="$GOOS" TARGETARCH="$GOARCH" VERSION="$VERSION" BINARY_NAME="$BINARY_NAME" | ||
- name: Release Notes | ||
run: | | ||
export VERSION=${{env.VERSION}} | ||
git log $(git describe HEAD~ --tags --abbrev=0)..HEAD --pretty='format:* %h %s%n * %an <%ae>' --no-merges >> .github/RELEASE_TEMPLATE.md | ||
curl -o /usr/local/bin/gomplate -sSL https://github.com/hairyhenderson/gomplate/releases/download/v3.10.0/gomplate_linux-amd64 | ||
chmod 755 /usr/local/bin/gomplate | ||
gomplate --file .github/RELEASE_TEMPLATE.md --out .github/RELEASE-NOTES.md | ||
- name: Release with Notes | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
name: Release ${{env.VERSION}} | ||
body_path: ".github/RELEASE-NOTES.md" | ||
draft: false | ||
files: ${{env.BINARY_NAME}} | ||
env: | ||
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
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,25 @@ | ||
name: Local | ||
|
||
on: | ||
push: | ||
# branches-ignore: | ||
# - '**' | ||
|
||
jobs: | ||
local_test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
path: ./ | ||
- name: Self test | ||
id: selftest | ||
uses: ./ | ||
with: | ||
address: ${{ secrets.ARGOCD_ADDR }} | ||
token: ${{ secrets.ARGOCD_TOKEN }} | ||
action: sync | ||
appName: blog | ||
|
||
|
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
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
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,6 @@ | ||
ARG ARGOCD_ACTIONS_VERSION=latest | ||
|
||
FROM ghcr.io/omegion/argocd-actions:${ARGOCD_ACTIONS_VERSION} | ||
|
||
ENTRYPOINT ["argocd-actions"] | ||
|
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package cmd | ||
|
||
import ( | ||
"log" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
// Root is root of cmd. | ||
func Root() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "argocd-actions", | ||
Short: "ArgoCD Actions.", | ||
Long: "Operate your ArgoCD applications from GitHub.", | ||
SilenceUsage: true, | ||
} | ||
|
||
cmd.PersistentFlags().String("address", "", "ArgoCD address") | ||
|
||
if err := cmd.MarkPersistentFlagRequired("address"); err != nil { | ||
log.Fatalf("Lethal damage: %s\n\n", err) | ||
} | ||
|
||
cmd.PersistentFlags().String("token", "", "ArgoCD token") | ||
|
||
if err := cmd.MarkPersistentFlagRequired("token"); err != nil { | ||
log.Fatalf("Lethal damage: %s\n\n", err) | ||
} | ||
|
||
return cmd | ||
} |
Oops, something went wrong.