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

Release using workflow_dispatch #172

Merged
merged 1 commit into from
Jul 7, 2023
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
42 changes: 30 additions & 12 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: Publish a release

on:
push:
branches:
- release
workflow_dispatch:

env:
VERSION_FILE: gradle.properties
Expand All @@ -13,7 +11,7 @@ env:

jobs:
publish_artifacts:
runs-on: macOS-latest
runs-on: macos-latest

steps:
- uses: actions/[email protected]
Expand Down Expand Up @@ -75,21 +73,42 @@ jobs:
version-file: ${{ env.VERSION_FILE }}
version-file-extraction-pattern: ${{ env.VERSION_EXTRACT_PATTERN }}

- name: Create, checkout, and push release branch
run: |
git config user.name eygraber
git config user.email [email protected]
git checkout -b releases/${{ env.RELEASE_VERSION }}
git push origin releases/${{ env.RELEASE_VERSION }}

- name: Import GPG Key
uses: crazy-max/[email protected]
with:
gpg_private_key: ${{ secrets.GIT_SIGNING_PRIVATE_KEY }}
passphrase: ${{ secrets.GIT_SIGNING_PRIVATE_KEY_PASSWORD }}
git_user_signingkey: true
git_commit_gpgsign: true
git_tag_gpgsign: true

- name: Store SHA of HEAD commit on ENV
run: echo "GIT_HEAD=$(git rev-parse HEAD)" >> $GITHUB_ENV

- name: Create tag
id: create_tag
uses: actions/github-script@v6.4.1
uses: actions/github-script@v6
with:
github-token: ${{ secrets.PUSH_PAT }}
script: |
const {GIT_HEAD} = process.env
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/${{ env.RELEASE_VERSION }}",
sha: context.sha
sha: `${GIT_HEAD}`
})

- name: Build changelog
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v3.7.2
uses: mikepenz/release-changelog-builder-action@v4
with:
configuration: "changelog_config.json"
toTag: ${{ env.RELEASE_VERSION }}
Expand All @@ -101,14 +120,13 @@ jobs:
uses: ncipollo/[email protected]
with:
body: ${{ steps.build_changelog.outputs.changelog }}
commit: release
name: Release ${{ env.RELEASE_VERSION }}
tag: ${{ env.RELEASE_VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.PUSH_PAT }}

- uses: actions/checkout@v3.5.3
- uses: actions/checkout@v3
with:
ref: 'master'
ref: ${{ github.event.head_ref }}
token: ${{ secrets.PUSH_PAT }}

- name: Prepare next dev version
Expand All @@ -119,7 +137,7 @@ jobs:

- name: Commit next dev version
id: commit_next_dev
uses: EndBug/add-and-commit@v9.1.3
uses: EndBug/add-and-commit@v9
with:
add: "['gradle.properties', 'README.md']"
default_author: github_actions
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_snapshot_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
publish_snapshot:
runs-on: macOS-latest
runs-on: macos-latest

steps:
- uses: actions/[email protected]
Expand Down
8 changes: 8 additions & 0 deletions changelog_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@
{
"title": "\uD83D\uDCE6 Dependencies",
"labels": ["dependencies"]
},
{
"title": "## \uD83D\uDCA5 GitHub Actions",
"labels": ["gh-actions"]
},
{
"title": "## \uD83D\uDC18 Gradle Improvements",
"labels": ["gradle"]
}
],
"ignore_labels": [
Expand Down