feat: add GitHub Actions workflows for code quality and automation (#2)

This commit is contained in:
2025-02-02 00:42:19 +02:00
committed by GitHub
parent af6ecdf6ca
commit 210aa969b3
105 changed files with 8807 additions and 408 deletions

36
github-release/README.md Normal file
View File

@@ -0,0 +1,36 @@
# ivuorinen/actions/github-release
## GitHub Release
### Description
Creates a GitHub release with a version and changelog.
### Inputs
| name | description | required | default |
| ----------- | ---------------------------------------------------- | -------- | ------- |
| `version` | <p>The version for the release.</p> | `true` | `""` |
| `changelog` | <p>The changelog or description for the release.</p> | `false` | `""` |
### Runs
This action is a `composite` action.
### Usage
```yaml
- uses: ivuorinen/actions/github-release@main
with:
version:
# The version for the release.
#
# Required: true
# Default: ""
changelog:
# The changelog or description for the release.
#
# Required: false
# Default: ""
```

54
github-release/action.yml Normal file
View File

@@ -0,0 +1,54 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/github-action.json
name: GitHub Release
description: 'Creates a GitHub release with a version and changelog.'
author: 'Ismo Vuorinen'
branding:
icon: 'tag'
color: 'blue'
inputs:
version:
description: 'The version for the release.'
required: true
changelog:
description: 'The changelog or description for the release.'
required: false
default: ''
runs:
using: composite
steps:
- name: Create GitHub Release with Autogenerated Changelog
if: ${{ inputs.changelog == '' }}
shell: bash
run: |
# Validate version format
if [[ ! "${{ inputs.version }}" =~ ^v?[0-9]+\.[0-9]+\.[0-9]+(-[\w.]+)?(\+[\w.]+)?$ ]]; then
echo "Error: Invalid version format. Must follow semantic versioning."
exit 1
fi
# Escape special characters in inputs
VERSION=$(echo "${{ inputs.version }}" | sed 's/[&/\]/\\&/g')
gh release create ${{ inputs.version }}
--repo="${GITHUB_REPOSITORY}" \
--title="${{ inputs.version }}" \
--generate-notes
- name: Create GitHub Release with Custom Changelog
if: ${{ inputs.changelog != '' }}
shell: bash
run: |
# Validate version format
if [[ ! "${{ inputs.version }}" =~ ^v?[0-9]+\.[0-9]+\.[0-9]+(-[\w.]+)?(\+[\w.]+)?$ ]]; then
echo "Error: Invalid version format. Must follow semantic versioning."
exit 1
fi
# Escape special characters in inputs
VERSION=$(echo "${{ inputs.version }}" | sed 's/[&/\]/\\&/g')
CHANGELOG=$(echo "${{ inputs.changelog }}" | sed 's/[&/\]/\\&/g')
gh release create ${{ inputs.version }}
--repo="${GITHUB_REPOSITORY}" \
--title="${{ inputs.version }}" \
--notes="${{ inputs.changelog }}"