Skip to content

Commit

Permalink
chore: ci jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
jlehtimaki committed Jun 20, 2024
1 parent 249f18b commit 418b1b5
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/pr-validation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: PR Validation

on:
pull_request:
branches:
- main

jobs:
run-reviewdog:
name: Run ReviewDog
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: ReviewDog - GolangCI Lint
uses: reviewdog/action-golangci-lint@v2
with:
go_version_file: go.mod
tool_name: GolangCI Lint
golangci_lint_flags: --config=.golangci.yaml --timeout=10m
fail_on_error: true
run-tests:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: Tests
run: make test-ci
82 changes: 82 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
name: Release

on:
push:
branches:
- main

jobs:
release:
name: Release
permissions:
contents: write
packages: write
id-token: write
runs-on: ubuntu-latest
steps:
- id: release-please
name: Release Please
uses: google-github-actions/release-please-action@v3
with:
release-type: go
package-name: discord-faucet
changelog-types: >-
[
{"type":"feat","section":"Features","hidden":false},
{"type":"fix","section":"Bug Fixes","hidden":false},
{"type":"chore","section":"Miscellaneous","hidden":true}
]
- name: Checkout
uses: actions/checkout@v3
if: steps.release-please.outputs.release_created
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v4
if: steps.release-please.outputs.release_created
with:
go-version-file: go.mod

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
if: steps.release-please.outputs.release_created

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
if: steps.release-please.outputs.release_created

- name: Run GoReleaser
if: steps.release-please.outputs.release_created
run: make release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Install Helm
uses: azure/setup-helm@v3
- name: Run chart-releaser
uses: helm/[email protected]
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push charts to GHCR
run: |
shopt -s nullglob
for pkg in .cr-release-packages/*; do
if [ -z "${pkg:-}" ]; then
break
fi
if ! helm push "${pkg}" "oci://ghcr.io/${GITHUB_REPOSITORY_OWNER}/charts"; then
echo '::warning:: helm push failed!'
fi
done

0 comments on commit 418b1b5

Please sign in to comment.