Merge pull request #27 from Qwizi/0.0.30 #30
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate Client | |
on: | |
push: | |
branches: | |
- master | |
- dev | |
jobs: | |
generate-schema: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.RELEASE_GIT_TOKEN }} | |
- name: "Install Poetry" | |
run: "pipx install poetry" | |
- name: Set up Python ${{matrix.python-version}} | |
uses: "actions/setup-python@v5" | |
with: | |
python-version: 3.11 | |
- name: "Install the project" | |
run: "poetry install" | |
- name: Install jq | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y jq | |
- name: Generate Schema | |
run: | | |
cd src | |
poetry run python manage.py spectacular --file openapi.json --validate --format openapi-json | |
echo "Schema generated" | |
VERSION=$(jq -r .info.version openapi.json) | |
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Commit and push changes | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Actions " | |
git add . | |
if [[ -n "$(git diff --cached)" ]]; then | |
git commit -m "Generate OpenAPI schema [skip ci]" | |
git push | |
else | |
echo "No changes to commit" | |
fi | |
- name: Discord notification | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
uses: Ilshidur/action-discord@master | |
with: | |
args: '{{ EVENT_PAYLOAD.repository.full_name }} successfully generated openapi schema.' | |
- name: Trigger Client Generation | |
uses: peter-evans/repository-dispatch@v2 | |
with: | |
token: ${{ secrets.RELEASE_GIT_TOKEN }} | |
repository: Qwizi/cs2-battle-bot-api-client | |
event-type: generate-client | |
- name: Release New Version | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: v${{ env.RELEASE_VERSION }} | |
tag_name: v${{ env.RELEASE_VERSION }} | |
token: ${{ secrets.RELEASE_GIT_TOKEN }} | |
- name: Discord notification | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
uses: Ilshidur/action-discord@master | |
with: | |
args: '{{ EVENT_PAYLOAD.repository.full_name }} successfully released new version.' |