-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
d81b6f0
commit 6fe8fcd
Showing
29 changed files
with
856 additions
and
3 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,46 @@ | ||
{ | ||
"rules": { | ||
"type-enum": [ | ||
2, | ||
"always", | ||
[ | ||
"chore", | ||
"ci", | ||
"deps", | ||
"feat", | ||
"fix", | ||
"patch", | ||
"style" | ||
] | ||
], | ||
"subject-empty": [ | ||
2, | ||
"never" | ||
], | ||
"type-case": [ | ||
2, | ||
"always", | ||
"lower-case" | ||
], | ||
"subject-case": [ | ||
0 | ||
], | ||
"type-empty": [ | ||
2, | ||
"never" | ||
], | ||
"scope-case": [ | ||
2, | ||
"always", | ||
"lower-case" | ||
], | ||
"scope-enum": [ | ||
0 | ||
], | ||
"header-max-length": [ | ||
2, | ||
"always", | ||
120 | ||
] | ||
} | ||
} |
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,19 @@ | ||
{ | ||
"template": "https://github.com/mirceanton/repository-templates", | ||
"commit": "3d3e42bb4fbe8a10583e3ba1f4d2bf8d33689d36", | ||
"checkout": null, | ||
"context": { | ||
"cookiecutter": { | ||
"project_name": "talswitcher", | ||
"repo_name": "talswitcher", | ||
"project_description": "A simple tool to help manage multiple talosconfig files.", | ||
"author": "Mircea-Pavel Anton", | ||
"go_version": "1.23.0", | ||
"_copy_without_render": [ | ||
".github/*" | ||
], | ||
"_template": "https://github.com/mirceanton/repository-templates" | ||
} | ||
}, | ||
"directory": "golang" | ||
} |
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,32 @@ | ||
## ================================================================================================ | ||
# Utility versions | ||
## ================================================================================================ | ||
ARG TASKFILE_VERSION=v3.38.0@sha256:308c4f5be86bffae3f956cbd7225c4fec69b0e7a89012120b818a10df45d7c59 | ||
ARG GOLINT_VERSION=v1.61.0-alpine@sha256:61e2d68adc792393fcb600340fe5c28059638d813869d5b4c9502392a2fb4c96 | ||
ARG GORELEASER_VERSION=v2.3.2@sha256:d62b4a18dfe3af7bd4da9e5954b496548ef04e73ae8f98cd75ba63a9ed4d73e5 | ||
|
||
|
||
## ================================================================================================ | ||
# "Build" stage for utilities with docker images already present | ||
## ================================================================================================ | ||
FROM ghcr.io/mirceanton/taskfile:${TASKFILE_VERSION} AS taskfile | ||
FROM golangci/golangci-lint:${GOLINT_VERSION} AS golangci-lint | ||
FROM goreleaser/goreleaser:${GORELEASER_VERSION} AS goreleaser | ||
|
||
|
||
## ================================================================================================ | ||
## Main image | ||
## ================================================================================================ | ||
FROM mcr.microsoft.com/devcontainers/go:1.23-bookworm@sha256:089dc0f3ae6e3a07b0896c28c0bde042fbb1e31fe87908ca55f32e37f56ff0c6 AS workspace | ||
|
||
# Install additional tools | ||
COPY --from=taskfile /task /usr/local/bin/task | ||
COPY --from=golangci-lint /usr/bin/golangci-lint /usr/local/bin/golangci-lint | ||
COPY --from=goreleaser /usr/bin/goreleaser /usr/local/bin/goreleaser | ||
|
||
# Generate bash completions | ||
RUN golangci-lint completion bash | sudo tee /etc/bash_completion.d/golangci-lint.bash > /dev/null | ||
RUN goreleaser completion bash | sudo tee /etc/bash_completion.d/goreleaser.bash > /dev/null | ||
|
||
USER vscode | ||
ENTRYPOINT [ "/bin/bash", "-l", "-c" ] |
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 @@ | ||
{ | ||
"name": "talswitcher", | ||
"build": { | ||
"dockerfile": "Dockerfile" | ||
}, | ||
"features": { | ||
"ghcr.io/devcontainers/features/docker-in-docker:2": {}, | ||
"ghcr.io/devcontainers/features/github-cli:1": {} | ||
}, | ||
"remoteUser": "vscode", | ||
"containerUser": "vscode", | ||
"updateRemoteUserUID": true | ||
} |
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 @@ | ||
* @mircea-pavel-anton |
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,18 @@ | ||
--- | ||
area/docker: | ||
- changed-files: | ||
- any-glob-to-any-file: ".dockerignore" | ||
- any-glob-to-any-file: "Dockerfile" | ||
- any-glob-to-any-file: ".devcontainer/devcontainer.json" | ||
|
||
area/github: | ||
- changed-files: | ||
- any-glob-to-any-file: ".github/**/*" | ||
|
||
area/go: | ||
- changed-files: | ||
- any-glob-to-any-file: "cmd/**/*" | ||
- any-glob-to-any-file: "internal/**/*" | ||
- any-glob-to-any-file: "pkg/**/*" | ||
- any-glob-to-any-file: "go.mod" | ||
- any-glob-to-any-file: "go.sum" |
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 @@ | ||
--- | ||
# ================================================================================================= | ||
# Areas | ||
# ================================================================================================= | ||
- name: area/docker | ||
color: "3970E4" | ||
- name: area/github | ||
color: "000000" | ||
- name: area/go | ||
color: "844FBA" | ||
|
||
# ================================================================================================= | ||
# Renovate Types | ||
# ================================================================================================= | ||
- name: renovate/go | ||
color: "844FBA" | ||
- name: renovate/container | ||
color: "3970E4" | ||
- name: renovate/github-action | ||
color: "000000" | ||
|
||
# ================================================================================================= | ||
# Semantic Types | ||
# ================================================================================================= | ||
- name: type/digest | ||
color: "ffeC19" | ||
- name: type/patch | ||
color: "ffeC19" | ||
- name: type/minor | ||
color: "ff9800" | ||
- name: type/major | ||
color: "f6412d" | ||
|
||
# ================================================================================================= | ||
# Size Types | ||
# ================================================================================================= | ||
- name: size/XS | ||
color: "0000ff" | ||
- name: size/S | ||
color: "000ff0" | ||
- name: size/M | ||
color: "00ff00" | ||
- name: size/L | ||
color: "0ff000" | ||
- name: size/XL | ||
color: "ff0000" | ||
- name: size/XXL | ||
color: "ff00ff" | ||
|
||
# ================================================================================================= | ||
# Issue Types | ||
# ================================================================================================= | ||
- name: issue/bug | ||
color: "ff0000" | ||
- name: issue/feature | ||
color: "00ff00" | ||
- name: issue/chore | ||
color: "0000ff" |
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,106 @@ | ||
--- | ||
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | ||
name: Cruft Sync | ||
|
||
on: | ||
# Manual Trigger | ||
workflow_dispatch: {} | ||
|
||
# "Wet" Run hourly | ||
schedule: | ||
- cron: "0 * * * *" | ||
|
||
jobs: | ||
update: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup Python | ||
uses: actions/[email protected] | ||
with: | ||
python-version: "3.12" | ||
|
||
- name: Install Cruft | ||
run: pip3 install cruft | ||
|
||
- name: Generate Token | ||
uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1.11.0 | ||
id: app-token | ||
with: | ||
app-id: "${{ secrets.BOT_APP_ID }}" | ||
private-key: "${{ secrets.BOT_APP_PRIVATE_KEY }}" | ||
|
||
- name: Checkout | ||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
with: | ||
fetch-depth: 0 | ||
token: "${{ steps.app-token.outputs.token }}" | ||
|
||
- name: Check if the `cruft_update` branch already exists | ||
id: check-branch | ||
run: | | ||
if git ls-remote --exit-code --heads origin cruft_update; then | ||
echo "branch_exists=true" | tee "$GITHUB_OUTPUT" | ||
else | ||
echo "branch_exists=false" | tee "$GITHUB_OUTPUT" | ||
fi | ||
- name: Create the `cruft_update` branch | ||
if: steps.check-branch.outputs.branch_exists == 'false' | ||
run: git branch cruft_update | ||
|
||
- name: Switch to the `cruft_update` branch | ||
run: git switch cruft_update | ||
|
||
- name: Check if a cruft update is available | ||
id: check-cruft | ||
run: | | ||
if ! cruft check; then | ||
echo "has_changes=true" | tee "$GITHUB_OUTPUT" | ||
else | ||
echo "has_changes=false" | tee "$GITHUB_OUTPUT" | ||
fi | ||
- name: Apply cruft update | ||
if: steps.check-cruft.outputs.has_changes == 'true' | ||
run: | | ||
cruft update --skip-apply-ask --refresh-private-variables | ||
git restore --staged . | ||
- name: Configure Git User | ||
if: steps.check-cruft.outputs.has_changes == 'true' | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Mr. Borboto" | ||
- name: Commit and push changes | ||
if: steps.check-cruft.outputs.has_changes == 'true' | ||
run: | | ||
git add -A | ||
git commit -m "chore(cruft): apply template updates" | ||
git push --set-upstream origin cruft_update | ||
- name: Check if a pull request already exists | ||
id: check-pr | ||
env: | ||
GH_TOKEN: "${{ steps.app-token.outputs.token }}" | ||
run: | | ||
PR_EXISTS=$(gh pr list --head cruft_update --json number | jq '. | length > 0') | ||
echo "pr_exists=$PR_EXISTS" | tee "$GITHUB_OUTPUT" | ||
- name: Compare the current branch with the main branch | ||
id: check-changes | ||
run: | | ||
if git diff --quiet origin/main; then | ||
echo "has_changes=false" | tee "$GITHUB_OUTPUT" | ||
else | ||
echo "has_changes=true" | tee "$GITHUB_OUTPUT" | ||
fi | ||
- name: Create pull request | ||
if: steps.check-pr.outputs.pr_exists == 'false' && steps.check-changes.outputs.has_changes == 'true' | ||
env: | ||
GH_TOKEN: "${{ steps.app-token.outputs.token }}" | ||
run: | | ||
gh pr create \ | ||
--title "chore(cruft): Apply updates from template" \ | ||
--body "This PR adds the changes from the upstream template." |
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,23 @@ | ||
--- | ||
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | ||
name: DevContainer Docker Build | ||
|
||
on: | ||
workflow_dispatch: {} | ||
|
||
pull_request: | ||
paths: | ||
- ".github/workflows/devcontainer-build.yaml" | ||
- ".devcontainer/Dockerfile" | ||
|
||
jobs: | ||
release: | ||
uses: mirceanton/reusable-workflows/.github/workflows/reusable-docker-build-push.yaml@b15f79125a97349d2f1043d1556d6e3cebae2227 # v3.4.5 | ||
secrets: inherit | ||
with: | ||
image: "ghcr.io/${{ github.repository }}-devcontainer" | ||
platforms: linux/amd64 | ||
tags: test | ||
context: ./.devcontainer | ||
dockerfile: ./.devcontainer/Dockerfile | ||
dry-run: true |
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,36 @@ | ||
--- | ||
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | ||
name: Release | ||
|
||
on: | ||
# Manual Trigger | ||
workflow_dispatch: | ||
inputs: | ||
dry-run: | ||
description: Dry Run | ||
required: false | ||
default: false | ||
type: boolean | ||
|
||
# Dry Run on any PR that changes this pipeline or that should ultimately trigger a release when merged | ||
pull_request: | ||
paths: | ||
- ".github/workflows/git-release.yaml" | ||
- "go.mod" | ||
- "go.sum" | ||
- "**/**.go" | ||
|
||
# "Wet" Run on any push to the main branch that modified a go-related file | ||
push: | ||
branches: ["main", "master"] | ||
paths: | ||
- "go.mod" | ||
- "go.sum" | ||
- "**/**.go" | ||
|
||
jobs: | ||
git: | ||
uses: mirceanton/reusable-workflows/.github/workflows/reusable-release-semver.yaml@b15f79125a97349d2f1043d1556d6e3cebae2227 # v3.4.5 | ||
secrets: inherit | ||
with: | ||
dry-run: ${{ inputs.dry-run || github.event_name == 'pull_request' }} |
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,32 @@ | ||
--- | ||
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | ||
name: Goreleaser | ||
|
||
on: | ||
# Manual Trigger | ||
workflow_dispatch: | ||
inputs: | ||
dry-run: | ||
description: Dry Run | ||
required: false | ||
default: false | ||
type: boolean | ||
|
||
# Dry Run on any PR that changes this pipeline or that should ultimately trigger a release when merged | ||
pull_request: | ||
paths: | ||
- ".github/workflows/goreleaser.yaml" | ||
- "go.mod" | ||
- "go.sum" | ||
- "**/**.go" | ||
|
||
# "Wet" Run on any tag push | ||
push: | ||
tags: ["*"] | ||
|
||
jobs: | ||
goreleaser: | ||
uses: mirceanton/reusable-workflows/.github/workflows/reusable-go-release.yaml@b15f79125a97349d2f1043d1556d6e3cebae2227 # v3.4.5 | ||
secrets: inherit | ||
with: | ||
dry-run: ${{ inputs.dry-run || github.event_name == 'pull_request' }} |
Oops, something went wrong.