Skip to content

Commit

Permalink
Merge pull request #32 from Kong/workflows
Browse files Browse the repository at this point in the history
Feat: Adds release and other workflows
  • Loading branch information
rspurgeon authored Mar 4, 2025
2 parents 6a4fb20 + 20428b4 commit e67454f
Show file tree
Hide file tree
Showing 4 changed files with 160 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/automerge-dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
# File is synced from Kong/template-generic and will be overwritten
name: Auto Actions

on: pull_request_target # yamllint disable-line rule:truthy

permissions:
contents: write
pull-requests: write


jobs:
dependabot-automerge:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Gather Dependabot metadata
id: metadata
uses: dependabot/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Approve PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Enable auto-merge
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
69 changes: 69 additions & 0 deletions .github/checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Checks
run-name: Checks, branch:${{ github.ref_name }}, triggered by @${{ github.actor }}

concurrency:
# Run only for most recent commit in PRs but for all tags and commits on main
# Ref: https://docs.github.com/en/actions/using-jobs/using-concurrency
group: ${{ github.workflow }}-${{ github.head_ref || github.sha }}
cancel-in-progress: true

on:
pull_request:
branches:
- '**'
push:
branches:
- 'main'
- 'release/[0-9]+.[0-9]+.x'
tags:
- '**'
workflow_dispatch: {}

jobs:
up-to-date:
runs-on: ubuntu-latest
outputs:
status: ${{ steps.up-to-date.outputs.status }}
steps:
- name: checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check if PR is up to date, if it is skip workflows for this ref
id: 'up-to-date'
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/')
uses: Kong/public-shared-actions/pr-previews/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

# This job is used to check if the secrets are available. If they are not, we'll skip jobs that require them.
should-run-with-secrets:
runs-on: ubuntu-latest
needs:
- up-to-date
if: needs.up-to-date.outputs.status != 'true'
outputs:
result: ${{ steps.check.outputs.result }}
steps:
- name: Check if secrets are available
id: check
run: |
if [ "${{ secrets.PULP_PASSWORD }}" == "" ]; then
echo "result=false" >> $GITHUB_OUTPUT
else
echo "result=true" >> $GITHUB_OUTPUT
fi
# We need this step to fail the workflow if any of the previous steps failed or were cancelled.
# It allows to use this particular job as a required check for PRs.
# Ref: https://github.com/orgs/community/discussions/26822#discussioncomment-3305794
passed:
runs-on: ubuntu-latest
needs:
- up-to-date
if: always()
steps:
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: |
echo "Some jobs failed or were cancelled."
exit 1
34 changes: 34 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: release

on:
push:
tags:
- 'v*.*'

jobs:
goreleaser:
timeout-minutes: ${{ fromJSON(vars.GHA_DEFAULT_TIMEOUT) }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: '~> v2'
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }}
- name: Upload assets
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/*
26 changes: 26 additions & 0 deletions .github/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CI Test

concurrency:
# Run only for most recent commit in PRs but for all tags and commits on main
# Ref: https://docs.github.com/en/actions/using-jobs/using-concurrency
group: ${{ github.workflow }}-${{ github.head_ref || github.sha }}
cancel-in-progress: true

on:
push:
branches:
- main
pull_request:
branches:
- '**'

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v5
- name: Setup golangci-lint
uses: golangci/golangci-lint-action@v6

0 comments on commit e67454f

Please sign in to comment.