Skip to content

Commit

Permalink
feat: integrate openapi client sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
tboerger committed Jun 4, 2024
1 parent 32b5883 commit 55d6493
Show file tree
Hide file tree
Showing 288 changed files with 121,216 additions and 116 deletions.
2 changes: 0 additions & 2 deletions .codacy.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
---
exclude_paths:
- .github/**
- changelog/**

- CHANGELOG.md

...
23 changes: 23 additions & 0 deletions .github/semantic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
commitsOnly: true
anyCommit: true
allowMergeCommits: true
allowRevertCommits: true

types:
- feat
- fix
- docs
- style
- refactor
- perf
- test
- build
- ci
- chore
- revert
- major
- minor
- patch

...
3 changes: 2 additions & 1 deletion .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ repository:
name: kleister-php
description: "Kleister: SDK for PHP"
homepage: https://kleister.eu
topics: kleister, minecraft, sdk, client, grpc, php
topics: kleister, minecraft, sdk, openapi, php

private: false
has_issues: true
Expand Down Expand Up @@ -34,6 +34,7 @@ branches:
restrictions:
apps:
- renovate
- kleister
users: []
teams:
- admins
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
name: automerge

"on":
workflow_dispatch:
pull_request:
branches:
- master

permissions:
contents: write
pull-requests: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'

steps:
- name: Generate token
id: token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.TOKEN_EXCHANGE_APP }}
installation_retrieval_mode: id
installation_retrieval_payload: ${{ secrets.TOKEN_EXCHANGE_INSTALL }}
private_key: ${{ secrets.TOKEN_EXCHANGE_KEY }}
permissions: >-
{"contents": "write", "pull_requests": "write", "issues": "write"}
- name: Fetch metadata
id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Approve request
id: approve
run: gh pr review --approve "${{github.event.pull_request.html_url}}"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Enable automerge
id: automerge
run: gh pr merge --rebase --auto "${{github.event.pull_request.html_url}}"
env:
GH_TOKEN: ${{ steps.token.outputs.token }}

...
36 changes: 0 additions & 36 deletions .github/workflows/changes.yml

This file was deleted.

56 changes: 56 additions & 0 deletions .github/workflows/flake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
name: flake

"on":
workflow_dispatch:
schedule:
- cron: "0 8 * * 1"

permissions:
contents: write
pull-requests: write

jobs:
flake:
runs-on: ubuntu-latest

steps:
- name: Generate token
id: token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.TOKEN_EXCHANGE_APP }}
installation_retrieval_mode: id
installation_retrieval_payload: ${{ secrets.TOKEN_EXCHANGE_INSTALL }}
private_key: ${{ secrets.TOKEN_EXCHANGE_KEY }}
permissions: >-
{"contents": "write", "pull_requests": "write"}
- name: Checkout source
id: source
uses: actions/checkout@v4

- name: Install nix
id: nix
uses: cachix/install-nix-action@v27

- name: Update flake
id: flake
uses: DeterminateSystems/update-flake-lock@v21
with:
commit-msg: "chore(flake): updated lockfile"
pr-title: "chore: automated flake update"
pr-body: "New flakelock generated, automerge should handle that!"
pr-labels: renovate
git-author-name: GitHub Actions
git-author-email: [email protected]
token: ${{ steps.token.outputs.token }}

- name: Enable automerge
id: automerge
if: steps.flake.outputs.pull-request-operation == 'created'
run: gh pr merge --rebase --auto "${{ steps.flake.outputs.pull-request-number }}"
env:
GH_TOKEN: ${{ steps.token.outputs.token }}

...
18 changes: 17 additions & 1 deletion .github/workflows/general.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,23 @@ jobs:

steps:
- name: Checkout source
id: source
uses: actions/checkout@v4

- name: Setup php
uses: shivammathur/setup-php@v2
with:
php-version: "8.3"

- name: Install generator
run: npm install @openapitools/openapi-generator-cli -g

- name: Run generate
run: bash hack/generate-client.sh

- name: Run install
run: composer install

- name: Run test
run: vendor/bin/phpunit

...
69 changes: 69 additions & 0 deletions .github/workflows/openapi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
name: openapi

"on":
workflow_dispatch:
schedule:
- cron: "0 8 * * *"

permissions:
contents: write
pull-requests: write

jobs:
openapi:
runs-on: ubuntu-latest

steps:
- name: Generate token
id: token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.TOKEN_EXCHANGE_APP }}
installation_retrieval_mode: id
installation_retrieval_payload: ${{ secrets.TOKEN_EXCHANGE_INSTALL }}
private_key: ${{ secrets.TOKEN_EXCHANGE_KEY }}
permissions: >-
{"contents": "write", "pull_requests": "write"}
- name: Checkout source
id: source
uses: actions/checkout@v4

- name: Setup php
uses: shivammathur/setup-php@v2
with:
php-version: "8.3"

- name: Install generator
run: npm install @openapitools/openapi-generator-cli -g

- name: Run generate
run: bash hack/generate-client.sh

- name: Create request
id: pr
uses: peter-evans/create-pull-request@v6
with:
commit-message: "feat: automated openapi client update"
delete-branch: true
branch: openapi-client-update
title: "feat: automated openapi client update"
body: "New openapi client generated, automerge should handle that!"
labels: openapi
committer: GitHub Actions <[email protected]>
token: ${{ steps.token.outputs.token }}

- name: Approve request
if: ${{ steps.pr.outputs.pull-request-url }}
run: gh pr review --approve "${{ steps.pr.outputs.pull-request-url }}"
env:
GH_TOKEN: ${{ secrets.BOT_ACCESS_TOKEN }}

- name: Enable automerge
if: ${{ steps.pr.outputs.pull-request-url }}
run: gh pr merge --rebase --auto "${{ steps.pr.outputs.pull-request-url }}"
env:
GH_TOKEN: ${{ secrets.BOT_ACCESS_TOKEN }}

...
55 changes: 55 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
name: release

"on":
workflow_dispatch:
schedule:
- cron: "0 8 * * 1"

permissions:
contents: read
id-token: write

jobs:
release:
runs-on: ubuntu-latest

steps:
- name: Checkout source
uses: actions/checkout@v4
with:
token: ${{ secrets.BOT_ACCESS_TOKEN }}

- name: Setup nodejs
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: Install releaser
run: |
npm install -g \
[email protected] \
[email protected] \
@semantic-release/changelog \
@semantic-release/git \
semantic-release-replace-plugin
- name: Run releaser
env:
GITHUB_TOKEN: ${{ secrets.BOT_ACCESS_TOKEN }}
run: semantic-release

- name: Write buildtime
run: date >| .github/RELEASE

- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
author_name: GitHub Actions
author_email: [email protected]
add: .github/RELEASE
message: "docs: automated release update [skip ci]"
push: true
commit: --signoff

...
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.direnv
.devenv

composer.phar
composer.lock

/vendor/

.php_cs.cache
.phpunit.result.cache
3 changes: 3 additions & 0 deletions .openapi-generator-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
git_push.sh
.travis.yml
composer.json
Loading

0 comments on commit 55d6493

Please sign in to comment.