Skip to content

Commit

Permalink
Release using workflow_dispatch
Browse files Browse the repository at this point in the history
  • Loading branch information
eygraber committed Jul 6, 2023
1 parent 643350d commit 5c3867f
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 13 deletions.
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

0 comments on commit 5c3867f

Please sign in to comment.