Skip to content

Commit

Permalink
fix: use github app to bypass the main branch protections.
Browse files Browse the repository at this point in the history
  • Loading branch information
drodarie committed Jul 31, 2024
1 parent f234265 commit 6b105ac
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Check public API
on: [push, pull_request]

jobs:
check-documentation:
check-api:
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest

Expand Down
33 changes: 24 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,24 @@ jobs:
old_tag: ${{ steps.semver.outputs.current }}

steps:
- name: Create Github token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.DBBS_APP_ID }}
private-key: ${{ secrets.DBBS_APP_PRIVATE_KEY }}

- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ steps.app-token.outputs.token }}

- name: Get Next Version
id: semver
uses: ietf-tools/semver-action@v1
with:
token: ${{ github.token }}
token: ${{ steps.app-token.outputs.token }}
branch: main

- name: Set up Python 3.11
Expand All @@ -38,23 +46,30 @@ jobs:
# Bump the version, dropping the leading `v` with `${x:1}`
bump-my-version replace --current-version=${oldv:1} --new-version=${newv:1} pyproject.toml
- name: Commit version change
- name: Commit & Push version change
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: main
commit_message: 'docs: bump version: ${{ steps.semver.outputs.current }} → ${{ steps.semver.outputs.next }}'
commit_message: 'docs: bump version: ${{ steps.semver.outputs.current }} → ${{ steps.semver.outputs.next }} [skip-ci]'

- uses: rickstaa/action-create-tag@v1
id: "tag_create"
- name: Create tag
uses: rickstaa/action-create-tag@v1
with:
tag: ${{ steps.semver.outputs.next }}
github_token: ${{ github.token }}
github_token: ${{ steps.app-token.outputs.token }}

release:
runs-on: ubuntu-latest
needs: bump

steps:
- name: Create Github token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.DBBS_APP_ID }}
private-key: ${{ secrets.DBBS_APP_PRIVATE_KEY }}

- name: Checkout Code
uses: actions/checkout@v4
with:
Expand All @@ -68,7 +83,7 @@ jobs:
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
token: ${{ steps.app-token.outputs.token }}
fromTag: ${{ needs.bump.outputs.tag }}
toTag: ${{ needs.bump.outputs.old_tag }}

Expand All @@ -81,13 +96,13 @@ jobs:
tag: ${{ needs.bump.outputs.tag }}
name: ${{ needs.bump.outputs.tag }}
body: ${{ steps.changelog.outputs.changes }}
token: ${{ github.token }}
token: ${{ steps.app-token.outputs.token }}

- name: Commit CHANGELOG.md
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: main
commit_message: 'docs: update CHANGELOG.md for ${{ github.ref_name }}'
commit_message: 'docs: update CHANGELOG.md for ${{ github.ref_name }} [skpi ci]'
file_pattern: CHANGELOG.md

deploy:
Expand Down

0 comments on commit 6b105ac

Please sign in to comment.