Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

Add new workflow to bump version and create Github Release #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
77 changes: 77 additions & 0 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Create Release

on:
workflow_dispatch:
inputs:
version:
description: "New release version (e.g. 0.8.0 or 0.8.1)"
required: true

jobs:
set_version:
runs-on: [self-hosted-org, linux]
steps:
- name: Checkout this repo
uses: actions/checkout@v2
with:
token: ${{ secrets.NOVUM_PRIVATE_REPOS }}

- name: Update medatata.json version
uses: jossef/action-set-json-field@v1
with:
file: metadata.json
field: version
value: ${{ github.event.inputs.version }}

- id: show_diff
name: Show git diff
run: |
git diff

- name: Commit & Push changes
id: push_version
uses: EndBug/add-and-commit@v7
with:
github_token: ${{ secrets.NOVUM_PRIVATE_REPOS }}
branch: 'master'
message: 'Bump version ${{ github.event.inputs.version }}'
author_email: [email protected]
author_name: tuentisre
Comment on lines +38 to +39
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be considered as a secret to avoid spam?
as this is a public repo...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably, i think security advisor will raise a warning with this

push: true

- name: get version
id: get_version
uses: notiz-dev/github-action-json-property@release
with:
path: 'metadata.json'
prop_path: 'version'

- id: show_version
name: Show version
run: |
echo "Release version ${{ steps.get_version.outputs.prop }}"
echo "Commit ${{ steps.push_version.outputs.commit_sha }}"

- id: get_release_notes
name: Get release notes
run: |
response=$(curl -s -X POST \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/releases/generate-notes \
-d '{"tag_name":"${{ steps.get_version.outputs.prop }}", "target_commitish": "${{ steps.push_version.outputs.commit_sha }}"}')
echo "JSON Release notes response:"
echo "${response}"
echo ::set-output name=releaseNotesJson::${response}

- id: create_github_release
name: Create Github release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.NOVUM_PRIVATE_REPOS }}
body: "Release ${{steps.get_version.outputs.version }}\n\n${{fromJson(steps.get_release_notes.outputs.releaseNotesJson).body}}"
target_commitish: ${{ steps.push_version.outputs.commit_sha }}
draft: false
prerelease: false
tag_name: "${{ steps.get_version.outputs.prop }}"
name: "v${{ steps.get_version.outputs.prop }}"