action-common-setup/.forgejo/workflows/Create Release.yml

87 lines
2.9 KiB
YAML

# SPDX-License-Identifier: AGPL-3.0-or-later
# SPDX-FileCopyrightText: 2024 GregoryDosh
---
name: Create Release
on:
push:
branches:
- main
paths:
- .version
jobs:
create-release:
name: Create Release
runs-on: ubuntu-act-latest
if: ${{ secrets.REPO_PUBLISH_TOKEN != '' }}
steps:
- name: Clone Repo into Workspace
uses: https://git.auengun.net/actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
token: ${{ secrets.REPO_PUBLISH_TOKEN }}
fetch-depth: 0
fetch-tags: true
- name: Create Env Vars
shell: bash
run: |
{
printf "RELEASE_TAG="
cat .version
echo ""
} >> "$GITHUB_ENV"
{
printf "RELEASE_PREV_TAG="
git describe `git rev-list --tags --no-walk --skip=0` --tags --exact-match | head -n 1
} >> "$GITHUB_ENV"
{
printf "COMMITS_SINCE_TAG="
git rev-list `git rev-list --tags --no-walk --skip=1 --max-count=1`..HEAD --count
} >> "$GITHUB_ENV"
cat "$GITHUB_ENV"
- name: Create Release Notes
id: release_notes
shell: bash
run: |
{
echo "RELEASE_NOTES<<EOF"
git log -n ${COMMITS_SINCE_TAG} --pretty=%B | grep -v "chore(release)"
echo "EOF"
} >> "$GITHUB_OUTPUT"
echo "Saved to $GITHUB_OUTPUT"
env:
COMMITS_SINCE_TAG: ${{ env.COMMITS_SINCE_TAG }}
- name: Create Release & Vet License Headers
id: create_release
shell: bash
run: |
make release
{
echo "RELEASE_SHA<<EOF"
cat release/action-common-setup.zip.sha256
echo "EOF"
} >> "$GITHUB_OUTPUT"
echo "Saved to $GITHUB_OUTPUT"
- name: Create Release
uses: https://git.auengun.net/actions/forgejo-release@fc0488c944626f9265d87fbc4dd6c08f78014c63 # v2.7.3
with:
token: ${{ secrets.REPO_PUBLISH_TOKEN }}
direction: upload
override: true
release-dir: release
tag: ${{ env.RELEASE_TAG }}
title: ${{ env.RELEASE_TAG }}
hide-archive-link: true
release-notes: |
# [Release ${{ env.RELEASE_TAG }}](${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ env.RELEASE_TAG }})
${{ steps.release_notes.outputs.RELEASE_NOTES }}
**sha256** `${{ steps.create_release.outputs.RELEASE_SHA }}`
---
[${{ github.repository }}](${{ github.server_url }}/${{ github.repository }}) ${{ github.server_url }}/${{ github.repository }}/src/commit/${{ github.sha }} [${{ env.RELEASE_PREV_TAG }}...${{ env.RELEASE_TAG }}](${{ github.server_url }}/${{ github.repository }}/compare/${{ env.RELEASE_PREV_TAG }}...${{ env.RELEASE_TAG }})