Skip to content

Commit

Permalink
Go updating and refactoring (#565)
Browse files Browse the repository at this point in the history
  • Loading branch information
tarampampam authored Sep 4, 2024
1 parent b6821d7 commit 9bf6c96
Show file tree
Hide file tree
Showing 37 changed files with 197 additions and 477 deletions.
26 changes: 0 additions & 26 deletions .codecov.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Docs: <https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/customizing-dependency-updates>
# yaml-language-server: $schema=https://json.schemastore.org/dependabot-2.0.json
# docs: https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/customizing-dependency-updates

version: 2

Expand Down
13 changes: 13 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-release-config.json
# docs: https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes

changelog:
categories:
- title: 🛠 Fixes
labels: [type:fix, type:bug]
- title: 🚀 Features
labels: [type:feature, type:feature_request]
- title: 📦 Dependency updates
labels: [dependencies]
- title: Other Changes
labels: ['*']
10 changes: 6 additions & 4 deletions .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
name: dependabot
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
# docs: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions

name: 🤖 Dependabot

on:
pull_request: {}
Expand All @@ -9,17 +12,16 @@ permissions:

jobs:
dependabot: # https://tinyurl.com/e69djmen
name: Enable auto-merge for Dependabot PRs
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- uses: dependabot/fetch-metadata@v2
id: metadata
with: {github-token: "${{ secrets.GITHUB_TOKEN }}"}

- name: Enable auto-merge for Dependabot PRs
if: ${{ contains(fromJSON('["version-update:semver-minor", "version-update:semver-patch"]'), steps.metadata.outputs.update-type) }}
- if: ${{ contains(fromJSON('["version-update:semver-minor", "version-update:semver-patch"]'), steps.metadata.outputs.update-type) }}
run: gh pr merge --auto --merge "$PR_URL"
continue-on-error: true
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7 changes: 5 additions & 2 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
name: documentation
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
# docs: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions

name: 📚 Documentation

on:
push:
Expand All @@ -12,7 +15,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: peter-evans/dockerhub-description@v4 # Action page: <https://github.com/peter-evans/dockerhub-description>
- uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKER_LOGIN }}
password: ${{ secrets.DOCKER_USER_PASSWORD }}
Expand Down
40 changes: 11 additions & 29 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
name: release
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
# docs: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions

name: 🚀 Release

on:
release: # Docs: <https://help.github.com/en/articles/events-that-trigger-workflows#release-event-release>
Expand All @@ -15,38 +18,23 @@ jobs:
arch: [amd64]
steps:
- uses: actions/checkout@v4

- uses: gacts/setup-node-with-cache@v1
with: {node-version: 19}

- run: npm ci --no-audit && npm run generate
working-directory: ./web

- run: npm run build
working-directory: ./web

- uses: gacts/setup-go-with-cache@v1
with: {go-version-file: go.mod}

- {uses: actions/setup-node@v4, with: {node-version: 22, cache: 'npm', cache-dependency-path: web/package-lock.json}}
- {working-directory: ./web, run: npm ci --no-audit && npm run generate}
- {working-directory: ./web, run: npm run build}
- {uses: gacts/setup-go-with-cache@v1, with: {go-version-file: go.mod}}
- run: |
go install "github.com/deepmap/oapi-codegen/cmd/oapi-codegen@v1.14.0"
go install "github.com/deepmap/oapi-codegen/v2/cmd/oapi-codegen@v2.2.0"
go generate ./...
- {uses: gacts/github-slug@v1, id: slug}

- name: Generate builder values
id: values
- id: values
run: echo "binary-name=webhook-tester-${{ matrix.os }}-${{ matrix.arch }}`[ ${{ matrix.os }} = 'windows' ] && echo '.exe'`" >> $GITHUB_OUTPUT

- env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
CGO_ENABLED: 0
LDFLAGS: -s -w -X gh.tarampamp.am/webhook-tester/internal/version.version=${{ steps.slug.outputs.version }}
run: go build -trimpath -ldflags "$LDFLAGS" -o "./${{ steps.values.outputs.binary-name }}" ./cmd/webhook-tester/

- name: Upload binary file to the release
uses: svenstaro/upload-release-action@v2
- uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.values.outputs.binary-name }}
Expand All @@ -58,24 +46,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- {uses: gacts/github-slug@v1, id: slug}

- uses: docker/setup-qemu-action@v3

- uses: docker/setup-buildx-action@v3

- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_LOGIN }}
password: ${{ secrets.DOCKER_PASSWORD }}

- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: docker/build-push-action@v6
with:
context: .
Expand Down
Loading

0 comments on commit 9bf6c96

Please sign in to comment.