Skip to content

Commit

Permalink
ci: generate release notes and convert them to html for tag
Browse files Browse the repository at this point in the history
Signed-off-by: Jackson Greer <[email protected]>
  • Loading branch information
jgrer committed Aug 7, 2024
1 parent cb3cde4 commit dc71090
Showing 1 changed file with 68 additions and 50 deletions.
118 changes: 68 additions & 50 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,60 +3,78 @@ on:
workflow_dispatch:
inputs:
release_version:
description: 'Which version are we releasing? (format vX.Y.Z)'
description: "Which version are we releasing? (format vX.Y.Z)"
required: true

permissions:
contents: write

jobs:
release:
name: "release"
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0
with:
egress-policy: audit

- name: Checkout repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0

- name: Configure github-actions[bot]
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
- name: Generate and Push Tags
run: |
version=${{ github.event.inputs.release_version }}
major=$(echo $version | cut -d. -f1)
minor=$(echo $version | cut -d. -f1-2)
git tag $version
git tag $minor -f
git tag $major -f
git push --set-upstream origin --tags -f
- name: Create GitHub release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run : |
gh release create "${{ github.event.inputs.release_version }}" --generate-notes > notes.txt
- name: Login to Docker Hub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Push Extension Image
run: |
version=${{ github.event.inputs.release_version }}
version_no_v=$(echo "$version" | cut -c2-)
changelog_text=$(cat notes.txt)
make push-extension TAG=$version_no_v CHANGELOG=changelog_text
release:
name: "release"
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@0d381219ddf674d61a7572ddd19d7941e271515c # v2.9.0
with:
egress-policy: audit

- name: Checkout repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0

- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: "20"

- name: Configure github-actions[bot]
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
- name: Generate and Push Tags
run: |
version=${{ github.event.inputs.release_version }}
major=$(echo $version | cut -d. -f1)
minor=$(echo $version | cut -d. -f1-2)
git tag $version
git tag $minor -f
git tag $major -f
git push --set-upstream origin --tags -f
- name: Create GitHub release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "${{ github.event.inputs.release_version }}" --generate-notes
- name: Get Release Notes
id: get_release_notes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
notes=$(gh release view "${{ github.event.inputs.release_version }}" --json body -q .body)
echo "$notes" > release_notes.md
- name: Install showdown
run: |
npm install -g showdown
- name: Convert from markdown to html
run: |
showdown makehtml -i release_notes.md -o release_notes.html
- name: Login to Docker Hub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Push Extension Image
run: |
version=${{ github.event.inputs.release_version }}
version_no_v=$(echo "$version" | cut -c2-)
make push-extension TAG=$version_no_v CHANGELOG=release_notes.html

0 comments on commit dc71090

Please sign in to comment.