Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎨 Extend release drafter #212

Merged
merged 2 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion .github/workflows/template_release_drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,32 @@ on:
version:
required: false
type: string
secrets:
token:
required: false
app_id:
required: true
private_key:
required: true

jobs:
update_release_draft:

name: update release draft
runs-on: ubuntu-22.04

env:
USING_APP_CREDENTIALS: ${{ secrets.app_id != '' && secrets.private_key != '' }}

steps:
- name: Get App Token
if: ${{ env.USING_APP_CREDENTIALS == 'true' }}
uses: tibdex/[email protected]
id: get_token
with:
app_id: ${{ secrets.app_id }}
private_key: ${{ secrets.private_key }}

- name: Update Release
uses: release-drafter/[email protected]
with:
Expand All @@ -32,4 +50,4 @@ jobs:
tag: ${{ inputs.tag }}
version: ${{ inputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ env.USING_APP_CREDENTIALS == 'true' && steps.get_token.outputs.token || secrets.token }}
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,13 @@ jobs:
tag: vX.Y.Z
# optional: version to be associated with the release
version: X.Y.Z
secrets:
# optional: access token for the release drafter
token: ${{ <your-token> }}
# optional: identifier of the GitHub App for authentication
app_id: ${{ <your-app-id> }}
# optional: private key of the GitHub App
private_key: ${{ <your-private-key> }}
```
</details>

Expand Down Expand Up @@ -422,6 +429,8 @@ With the current implementation of the reusable workflows from GitHub, we have s

- It isn't possible to [access environment variables][reusable-workflow-env] and [secrets][reusable-workflow-secrets], so it's necessary to pass them to the workflow. But we don't want to do it for all secrets.

There are also some [further limitations][further-limitations] if you want to use the `GITHUB_TOKEN`.

## Release 🔖

To create a new release just use [this page][release-new] and publish the draft release.
Expand Down Expand Up @@ -451,3 +460,4 @@ This project is licensed under the Apache-2.0 License - see the [LICENSE.md](LIC
[release-new]: https://github.com/Staffbase/gha-workflows/releases
[reusable-workflow-secrets]: https://github.com/orgs/community/discussions/17554
[reusable-workflow-env]: https://github.com/orgs/community/discussions/26671
[further-limitations]: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow