Skip to content

Commit

Permalink
🎉 First import
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinemartin committed Jan 21, 2023
0 parents commit 3727448
Show file tree
Hide file tree
Showing 24 changed files with 1,336 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.{yml,yaml,toml,html,css,scss,json,ts,tsx}]
indent_size = 2

[Makefile]
indent_style = tab
indent_size = 4
6 changes: 6 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
39 changes: 39 additions & 0 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Go build and test

on:
push:
branches: ["*"]
tags-ignore: ["v*"]
pull_request:
branches: ["main"]

jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: ^1
id: go

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

- name: Get dependencies
run: go get -v -t -d ./...

- name: Build
run: go build -v .

- name: Test
run: go test -v .

- name: Run runtime test
run: |
cd tests
./test_krmfnbuiltin.sh
61 changes: 61 additions & 0 deletions .github/workflows/release-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Test release

on:
pull_request:
branches: ["main"]

jobs:
snapshot:
name: Test GoReleaser Snapshot
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ^1
- name: Import Signature key
shell: bash
run: |
echo -e "$GPG_PRIVATE_KEY" > gpg_key.asc
openssl rsa -in gpg_key.asc -pubout -out [email protected]
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
- name: Docker Login
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run GoReleaser Snapshot
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: --snapshot --skip-publish --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Build APK repo
# uses: ./.github/actions/make-apkindex
# with:
# apk_files: dist/*.apk
# signature_key: "${{ secrets.GPG_PRIVATE_KEY }}"
# signature_key_name: [email protected]
# destination: dist/repo
# - name: Commit repo to kaweezle.com
# uses: cpina/github-action-push-to-another-repository@main
# env:
# API_TOKEN_GITHUB: ${{ secrets.REPO_ACCESS_TOKEN }}
# with:
# source-directory: dist/repo
# destination-github-username: kaweezle
# destination-repository-name: kaweezle.github.io
# # TODO: replace with kaweezle-devel
# user-name: antoinemartin
# user-email: [email protected]
# target-branch: release-krmfnbuiltin-test
# target-directory: docs/repo
# commit-message: krmfnbuiltin APK repo ${{ github.ref_name }}
47 changes: 47 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Make release on tag

on:
push:
tags: ["v*"]

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ^1
- name: Import Signature key
shell: bash
run: |
echo -e "$GPG_PRIVATE_KEY" > gpg_key.asc
openssl rsa -in gpg_key.asc -pubout -out [email protected]
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
- name: Docker Login
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Trigger APK repo build
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.ROOTFS_ACCESS_TOKEN }}
repository: kaweezle/kaweezle.github.io
event-type: krmfnbuiltin-release
client-payload: >-
{"version": "${{ github.ref_name }}", "ref": "${{ github.ref }}",
"sha": "${{ github.sha }}"}
14 changes: 14 additions & 0 deletions .github/workflows/tag-on-version-change.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Create version tag on code change

on:
push:
branches: [main]

jobs:
versioner:
runs-on: ubuntu-latest
steps:
- name: Update Version
uses: antoinemartin/tag-action@main
env:
ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/
gpg_key.asc
[email protected]
krmfnbuiltin
dist/
75 changes: 75 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com
before:
hooks:
- go mod tidy
builds:
- env:
- CGO_ENABLED=0
goos:
- darwin
- linux
- windows
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -trimpath
ldflags:
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X
main.date={{ .CommitDate }} -X main.builtBy=goreleaser
binary: krmfnbuiltin
id: krmfnbuiltin
archives:
- format: binary
name_template: '{{ .Binary }}_v{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'
checksum:
name_template: "SHA256SUMS"
snapshot:
name_template: "{{ incpatch .Version }}-devel"
changelog:
sort: asc
filters:
exclude:
- "^docs"
- "^test"
- "^ci"
- "^refactor"
- Merge pull request
- Merge branch
- go mod tidy
nfpms:
- formats: [apk]
license: Apache 2.0
package_name: krmfnbuiltin
file_name_template: >-
{{ .PackageName }}-
{{- .Version }}.
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
{{- if .Mips }}_{{ .Mips }}{{ end }}
maintainer: Kaweezle <[email protected]>
description: KRM function (Kustomize) to decrypt SOPS encoded resources
homepage: https://github.com/kaweezle/krmfnbuiltin
bindir: /usr/bin
apk:
signature:
key_file: gpg_key.asc
key_name: [email protected]
release:
extra_files:
- glob: ./[email protected]
dockers:
- image_templates:
- "ghcr.io/kaweezle/krmfnbuiltin:latest"
- "ghcr.io/kaweezle/krmfnbuiltin:{{ .Version }}"
dockerfile: Dockerfile
build_flag_templates:
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.description={{ .ProjectName }}
- --label=org.opencontainers.image.url=https://github.com/kaweezle/krmfnbuiltin
- --label=org.opencontainers.image.source=https://github.com/kaweezle/krmfnbuiltin
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.licenses=Apache-2.0
12 changes: 12 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"overrides": [
{
"files": "*.md",
"options": {
"proseWrap": "always",
"tabWidth": 2
}
}

]
}
2 changes: 2 additions & 0 deletions .sops.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
creation_rules:
- encrypted_regex: '^(data|stringData)$'
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM alpine:latest
COPY krmfnbuiltin /usr/local/bin/config-function
CMD ["config-function"]
Loading

0 comments on commit 3727448

Please sign in to comment.