Skip to content

GitHub Release

GitHub Release #10

Workflow file for this run

name: GitHub Release
on:
workflow_dispatch:
inputs:
version:
description: "Version number to release"
required: true
env:
GHP_BASE_URL: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}
jobs:
release:
name: Create GitHub Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install PyYaml
run: pip install pyyaml
- name: Publish to Galaxy
uses: artis3n/[email protected]
with:
api_key: ${{ secrets.GALAXY_API_KEY }}
- name: Validate version is published to Galaxy
run: curl --head -s -f -o /dev/null https://galaxy.ansible.com/download/lowlydba-sqlserver-${{ github.event.inputs.version }}.tar.gz
- name: Build release description
shell: python
run: |
import os
import yaml
ver = '${{ github.event.inputs.version }}'
ver_anchor = str.replace(ver, '.', '-')
with open('changelogs/changelog.yaml', 'r') as s:
ri = yaml.safe_load(s)
if ('release_summary' not in ri['releases'][ver]['changes']):
summary = 'No release summary available.'
else:
summary = ri['releases'][ver]['changes']['release_summary']
reldate = ri['releases'][ver]['release_date']
description = '''## Summary
Released: %s
%s
---
View the [complete changelog](https://github.com/lowlydba/lowlydba.sqlserver/blob/main/CHANGELOG.rst#v%s) to see all changes.
View the [full documentation for release ${{ github.event.inputs.version }}](${{ env.GHP_BASE_URL }}/tag/${{ github.event.inputs.version }}).
''' % (reldate, summary, ver_anchor)
with open(os.environ['GITHUB_ENV'], 'a') as e:
e.write("RELEASE_DESCRIPTION<<EOF\n%s\nEOF" % description)
- name: Create Release
id: create_release
uses: softprops/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
token: ${{ env.GITHUB_TOKEN }}
tag_name: ${{ github.event.inputs.version }}
name: ${{ github.event.inputs.version }}
body: ${{ env.RELEASE_DESCRIPTION }}