Skip to content

Commit

Permalink
✨ Project bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
0x46616c6b committed Sep 12, 2023
0 parents commit 194ea08
Show file tree
Hide file tree
Showing 14 changed files with 1,044 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @0x46616c6b
26 changes: 26 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "weekly"
day: "friday"
time: "09:00"
timezone: "Europe/Berlin"

- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "weekly"
day: "friday"
time: "09:00"
timezone: "Europe/Berlin"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "friday"
time: "09:00"
timezone: "Europe/Berlin"
41 changes: 41 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name-template: "$RESOLVED_VERSION"
tag-template: "$RESOLVED_VERSION"
categories:
- title: "🚀 Features"
labels:
- "feature"
- "enhancement"
- title: "🐛 Bug Fixes"
labels:
- "fix"
- "bugfix"
- "bug"
- title: "🧹 Maintenance"
labels:
- "chore"
- "dependencies"
version-resolver:
major:
labels:
- "feature"
minor:
labels:
- "enhancement"
patch:
labels:
- "fix"
- "bugfix"
- "bug"
- "chore"
- "dependencies"
default: patch
template: |
## Changes
$CHANGES
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...$RESOLVED_VERSION
## Docker
- `docker pull systemli/dereferrer:$RESOLVED_VERSION`
70 changes: 70 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Integration

on:
push:
branches:
- main
pull_request:

jobs:
test:
name: Test
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup go
uses: actions/setup-go@v4
with:
go-version-file: "go.mod"
cache: true

- name: Vet
run: go vet

- name: Test
run: go test ./...

build:
name: Build
runs-on: ubuntu-22.04
needs:
- test
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup go
uses: actions/setup-go@v4
with:
go-version-file: "go.mod"
cache: true

- name: Build
run: go build ./...

- name: Docker
run: docker build .

automerge:
name: Merge Automatically
needs: [test, build]
runs-on: ubuntu-20.04
if: ${{ github.actor == 'dependabot[bot]' }}

permissions:
pull-requests: write
contents: write

steps:
- name: Obtain Access Token
id: acces_token
run: |
TOKEN="$(npx obtain-github-app-installation-access-token ci ${{ secrets.SYSTEMLI_APP_CREDENTIALS_TOKEN }})"
echo "token=$TOKEN" >> $GITHUB_OUTPUT
- name: Merge
uses: fastify/github-action-merge-dependabot@v3
with:
github-token: ${{ steps.acces_token.outputs.token }}
18 changes: 18 additions & 0 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Quality

on:
push:
branches:
- main
pull_request_target:

jobs:
golangci:
name: GolangCI
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: GolangCI
uses: golangci/golangci-lint-action@v3
18 changes: 18 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Release Drafter

on:
push:
branches:
- main

jobs:
release:
name: Update Release
runs-on: ubuntu-22.04
steps:
- name: Publish Release
uses: release-drafter/release-drafter@v5
with:
publish: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Release

on:
release:
types: [published]

jobs:
release:
name: Release
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup go
uses: actions/setup-go@v4
with:
go-version-file: "go.mod"
cache: true

- name: Login to Docker Hub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build Releases
uses: goreleaser/[email protected]
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29 changes: 29 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
before:
hooks:
- go mod tidy
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarm:
- "6"
- "7"
ldflags:
- -s -w
dockers:
- goos: linux
goarch: amd64
image_templates:
- "systemli/dereferrer:{{ .Tag }}"
- "systemli/dereferrer:{{ .Major }}"
- "systemli/dereferrer:{{ .Major }}.{{ .Minor }}"
- "systemli/dereferrer:latest"
checksum:
name_template: "checksums.txt"
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
skip: true
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM alpine:3.18.2 as builder

WORKDIR /go/src/github.com/systemli/dereferrer

ENV USER=appuser
ENV UID=10001

RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
"${USER}"

FROM scratch

COPY --from=builder /etc/passwd /etc/passwd
COPY --from=builder /etc/group /etc/group
COPY dereferrer /dereferrer

USER appuser:appuser

EXPOSE 8080

ENTRYPOINT ["/dereferrer"]
Loading

0 comments on commit 194ea08

Please sign in to comment.