57 lines
1.4 KiB
YAML
57 lines
1.4 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*.*.*"
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Build changelog
|
|
id: changelog
|
|
shell: bash
|
|
run: |
|
|
git fetch --tags --force
|
|
current_tag="${GITEA_REF_NAME}"
|
|
previous_tag="$(git tag --sort=-creatordate | grep -v "^${current_tag}$" | head -n 1)"
|
|
if [ -n "$previous_tag" ]; then
|
|
range="${previous_tag}..${current_tag}"
|
|
header="Changes since ${previous_tag}"
|
|
else
|
|
range="${current_tag}"
|
|
header="Initial release"
|
|
fi
|
|
{
|
|
echo "notes<<EOF"
|
|
echo "## ${header}"
|
|
git log "${range}" --pretty=format:"- %s (%h)" --no-merges
|
|
echo
|
|
echo "EOF"
|
|
} >> "$GITEA_OUTPUT"
|
|
|
|
- name: Package extension
|
|
shell: bash
|
|
run: |
|
|
mkdir -p dist
|
|
zip -r "dist/json-content-formatter-${GITEA_REF_NAME}.zip" \
|
|
. \
|
|
-x ".git/*" \
|
|
-x ".gitea/*" \
|
|
-x "dist/*"
|
|
|
|
- name: Create release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
body: ${{ steps.changelog.outputs.notes }}
|
|
files: dist/json-content-formatter-${{ gitea.ref_name }}.zip
|