Skip to content

Commit

Permalink
feat: switch to semantic-release
Browse files Browse the repository at this point in the history
This commit switches the release utility to 'semantic-release' and adds
'pre-commit' to enforce code styles.

- removed obsolete Bazel WORKSPACE
- remove obsolete release files
- run 'pre-commit' for all files
  • Loading branch information
mvprowess committed Sep 24, 2024
1 parent d069dc5 commit 430a672
Show file tree
Hide file tree
Showing 27 changed files with 354 additions and 392 deletions.
2 changes: 1 addition & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ common --enable_bzlmod
build --workspace_status_command=$(pwd)/scripts/status.sh
build --verbose_failures

test --test_env=HOME
test --test_env=HOME
12 changes: 0 additions & 12 deletions .editorconfig

This file was deleted.

2 changes: 1 addition & 1 deletion .github/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
# This file is currently manually managed.

FMJ Studios
Maximilian Gindorfer <info@fmj.dev>
Maximilian Gindorfer <info@fmj.dev>
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# As the admin and steward of the project, FMJdev "owns" all code
* @FMJdev
* @FMJdev
2 changes: 1 addition & 1 deletion .github/linters/.shellcheckrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
external-sources=true
external-sources=true
53 changes: 19 additions & 34 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,43 +22,28 @@ concurrency:
jobs:
release:
runs-on: ubuntu-latest
outputs:
created: ${{ steps.release.outputs.release_created }}
tag: ${{ steps.release.outputs.tag_name }}
steps:
- name: Auto-merge Release-Please PR
run: |
gh pr merge ${{ github.event.client_payload.pr_number }} --squash
- name: Run Release-Please
uses: googleapis/release-please-action@v4
id: release
with:
token: ${{ secrets.ACCESS_TOKEN }}
config-file: "release-please-config.json"
manifest-file: ".release-please-manifest.json"
release-type: bazel

artifacts:
runs-on: ubuntu-latest
needs: [release]
if: ${{ needs.release.outputs.created && !failure() }}
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
GH_TOKEN: ${{ secrets.ACCESS_TOKEN }}
steps:
- name: Download Release artifacts
uses: actions/download-artifact@v4
with:
name: distributables
path: dist
github-token: ${{ env.GITHUB_TOKEN }}
repository: ${{ github.repository }}
run-id: ${{ github.event.client_payload.run_id }}
- name: Checkout
uses: actions/checkout@v4

- name: Build final SHA256 checksums
- name: Generate Release artifacts
run: |
scripts/release.sh executables
scripts/release.sh tarballs
scripts/release.sh checksums
- name: Upload artifacts to Release-Please GitHub release
run: |
gh release upload ${{ needs.release.outputs.tag }} dist/*.tar.gz dist/CHECKSUMS.txt
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
with:
semantic_version: 24
branches: |
[
'main',
'next'
]
extra_plugins: |
@semantic-release/changelog@6.0.3
@semantic-release/git@10.0.1
conventional-changelog-conventionalcommits@8.0.0
59 changes: 21 additions & 38 deletions .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,33 @@ concurrency:
group: "${{ github.workflow }}@${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22

- name: GolangCI-Lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.61

test:
name: Test
needs: [lint]
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
CACHE_PATH: ${{ matrix.os == 'macos-latest' && '/private/var/tmp/_bazel_runner/' || '~/.cache/bazel' }}
outputs:
created: "${{ steps.release.outputs.prs_created }}"
pr: "${{ steps.output-pr.outputs.number }}"
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -60,51 +75,19 @@ jobs:
run: |
bazel --output_user_root=${{ env.CACHE_PATH }} test //...
# create a release PR
- name: Run Release-Please
uses: googleapis/release-please-action@v4
id: release
with:
token: ${{ env.GITHUB_TOKEN }}
config-file: "release-please-config.json"
manifest-file: ".release-please-manifest.json"
release-type: bazel

- name: Output crated PR number
id: output-pr
run: |
echo "number=${{ fromJSON(steps.release.outputs.pr).number }}" >> "$GITHUB_OUTPUT"
# Fail here if tests didn't succeed
- name: Generate Release artifacts
if: ${{ success() && steps.release.outputs.prs_created }}
run: |
scripts/release.sh executables
scripts/release.sh tarballs
- name: Upload Release artifacts
if: ${{ success() && steps.release.outputs.prs_created }}
uses: actions/upload-artifact@v4
with:
name: distributables
path: |
dist/*.tar.gz
dist/*.txt
dispatch:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
needs: [test]
steps:
- name: Dispatch a release workflow run
if: ${{ needs.test.outputs.created }}
if: ${{ always() && contains(join(needs.*.result, ','), 'success') }} # ref: https://github.com/actions/runner/issues/1251
uses: actions/github-script@v7
with:
github-token: "${{ env.GITHUB_TOKEN }}"
script: |
const payload = {
pr_number: "${{ needs.test.outputs.pr }}"
run_id: "${{ github.run_id }}",
sha: "${{ github.sha }}"
}
Expand All @@ -113,7 +96,7 @@ jobs:
const { owner, repo } = context.repo;
await github.rest.repos.createDispatchEvent({
owner,
owner,
repo,
event_type: 'release',
client_payload: payload
Expand Down
21 changes: 21 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/markdownlint/markdownlint
rev: v0.13.0
hooks:
- id: markdownlint
args:
- "-r ~MD013"
- repo: https://github.com/rhysd/actionlint
rev: v1.7.2
hooks:
- id: actionlint
- repo: https://github.com/crate-ci/typos
rev: v1.24.6
hooks:
- id: typos
17 changes: 0 additions & 17 deletions .prettierrc.json

This file was deleted.

3 changes: 0 additions & 3 deletions .release-please-manifest.json

This file was deleted.

63 changes: 63 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"branches": [
"main",
"next"
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits",
"parserOpts": {
"noteKeywords": [
"BREAKING CHANGE",
"BREAKING CHANGES",
"BREAKING"
]
}
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"parserOpts": {
"noteKeywords": [
"BREAKING CHANGE",
"BREAKING CHANGES",
"BREAKING"
]
}
}
],
[
"@semantic-release/github",
{
"assets": [
{
"path": "dist/*.tar.gz",
"label": "Distribution tarballs"
},
{
"path": "dist/CHECKSUMS.txt",
"label": "SHA256 Checksums"
}
]
}
],
[
"@semantic-release/changelog",
{
"changelogFile": "CHANGELOG.md"
}
],
[
"@semantic-release/git",
{
"assets": [
"CHANGELOG.md"
]
}
]
]
}
39 changes: 0 additions & 39 deletions CHANGELOG.md

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
1 change: 0 additions & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

module(
name = "gopskit",
version = "1.0.1",
repo_name = "com_github_fmjstudios_gopskit",
)

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ build system in combination with their first-party [Gazelle][gazelle] `BUILD` fi

## 📖 Overview

The toolkit offers a plethora of functionalities like setting up HashiCorp's [Vault][vault] with [`waltr`][waltr],
The toolkit offers a plethora of functionalities like setting up HashCorp's [Vault][vault] with [`waltr`][waltr],
registering various applications for SSO authentication with [Keycloak][keycloak] using [`ssolo`][ssolo]. Never
write [Helmfile][helmfile] `values.yaml` template files to manage applications on your cluster again. Instead, generate
them using [`fillr`][fillr]. Are you running your own custom private Certificate Authority using
Expand All @@ -37,7 +37,7 @@ Like most modern [Go][go] projects the various executables are located within th
quick-reference list as an overview:

- [`ssolo`][ssolo]: manage SSO authentication for various apps using Keycloak
- [`waltr`][waltr]: configure and manage [HashiCorp's Vault][vault]
- [`waltr`][waltr]: configure and manage [HashCorp's Vault][vault]
- [`fillr`][fillr]: create Helmfile templates automatically
- [`steppa`][steppa]: generate and manage SmallStep PKI values
- [`amtrac`][amtrac]: generate SQL dumps from the German KBA's data files using Docker
Expand Down
5 changes: 0 additions & 5 deletions WORKSPACE

This file was deleted.

2 changes: 1 addition & 1 deletion docs/TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

- [Kubernetes Go Client - Examples](https://github.com/iximiuz/client-go-examples)
- [Kubernetes Go Client - Exec Example](https://github.com/a4abhishek/Client-Go-Examples)
- [Fedora - Exeucting remote Kubernetes processes](https://miminar.fedorapeople.org/_preview/openshift-enterprise/registry-redeploy/go_client/executing_remote_processes.html)
- [Fedora - Executing remote Kubernetes processes](https://miminar.fedorapeople.org/_preview/openshift-enterprise/registry-redeploy/go_client/executing_remote_processes.html)
- [Kubernetes Go Client - Port Forward Example](https://github.com/gianarb/kube-port-forward/blob/master/main.go)
- [Kubernetes Go Client - Generic Forwarder](https://github.com/anthhub/forwarder)
- [Kubernetes Go Client - Dynamic Client (for CRDs)](https://caiorcferreira.github.io/post/the-kubernetes-dynamic-client/)
Expand Down
Loading

0 comments on commit 430a672

Please sign in to comment.