Code Issues Pull Requests Actions Packages Projects Releases 15 Wiki Activity Security Code Quality
21 Commits
4 changed files with 91 additions and 45 deletions

No files matched your search

+67
View File
@@ -0,0 +1,67 @@
name: Release
on:
push:
tags:
- "v*.*.*"
permissions:
contents: write
releases: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
release:
runs-on: ubuntu-latest
name: Release
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
# Public source. A repo without its own cliff.toml downloads this file.
- name: Use shared cliff.toml when the repo has none
env:
CLIFF_REPO: ${{ vars.CLIFF_CONFIG_REPO || 'gitea/global-workflow' }}
run: |
set -euo pipefail
if [[ -f cliff.toml ]]; then
echo "Using cliff.toml from this repository"
exit 0
fi
url="${GITHUB_API_URL}/repos/${CLIFF_REPO}/raw/cliff.toml?ref=main"
echo "No cliff.toml in this repository; fetching ${url}"
curl --silent --show-error --fail --location --output cliff.toml "$url"
# Gitea's GITHUB_TOKEN is rejected by api.github.com. Pass a github.com PAT instead.
- name: Generate release notes
uses: orhun/git-cliff-action@v4
with:
config: cliff.toml
args: --latest --strip header
env:
OUTPUT: release-notes.md
- name: Read Release Token from the runner
run: |
if [[ -z "${RELEASE_TOKEN:-}" ]]; then
exit 1
fi
{
echo "RELEASE_TOKEN<<__RELEASE_TOKEN__"
printf '%s\n' "$RELEASE_TOKEN"
echo "__RELEASE_TOKEN__"
} >> "$GITHUB_ENV"
- name: Create release
uses: softprops/action-gh-release@v3
with:
# prerelease only when the tag contains "-alpha", "-beta" or "-rc". ex: v1.0.0-alpha.1, v1.0.0-beta.1, v1.0.0-rc.1
prerelease: ${{ contains(github.ref, '-alpha') || contains(github.ref, '-beta') || contains(github.ref, '-rc') }}
body_path: release-notes.md
token: ${{ env.RELEASE_TOKEN }} # Use this token if you want user author is 'github-actions' bot
draft: false
@@ -21,11 +21,23 @@ jobs:
output-file: sbom.json
upload-artifact: false
- name: Read API key from the runner
run: |
if [[ -z "${DT_API_KEY:-}" ]]; then
echo "DT_API_KEY is not set on this runner"
exit 1
fi
{
echo "DT_API_KEY<<__DT_API_KEY__"
printf '%s\n' "$DT_API_KEY"
echo "__DT_API_KEY__"
} >> "$GITHUB_ENV"
- name: Upload SBOM to Dependency-Track
uses: DependencyTrack/gh-upload-sbom@v4
with:
server-hostname: "${{ vars.DT_HOSTNAME }}"
api-key: "${{ secrets.DT_API_KEY }}"
api-key: ${{ env.DT_API_KEY }}
project-name: "${{ github.repository }}"
project-version: "latest"
bom-filename: "sbom.json"
-40
View File
@@ -1,40 +0,0 @@
name: Release
on:
push:
tags:
- "**"
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
release:
runs-on: ubuntu-latest
name: Release
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
# Gitea's GITHUB_TOKEN is rejected by api.github.com. Pass a github.com PAT instead.
- name: Generate release notes
uses: orhun/git-cliff-action@v4
with:
config: cliff.toml
args: --latest --strip header
github_token: ${{ secrets.PAT_GITHUB }}
env:
OUTPUT: release-notes.md
- name: Create release
uses: softprops/action-gh-release@v3
with:
token: ${{ secrets.RELEASE_TOKEN }}
prerelease: ${{ contains(github.ref, '-alpha') || contains(github.ref, '-beta') || contains(github.ref, '-rc') }}
body_path: release-notes.md
+11 -4
View File
@@ -25,11 +25,18 @@ body = """
- {% if commit.scope %}**{{ commit.scope }}**: {% endif %}{{ commit.message | upper_first }} ({{ commit.id | truncate(length=7, end="") }})
{%- endfor %}
{% endfor %}
{%- set authors = commits | map(attribute="author.name") | unique | sort %}
{% if authors | length > 0 %}
{#- Author names vary per machine (tienbh / Tien-BH / ...); the email local part matches the Gitea username. -#}
{%- set_global usernames = [] %}
{%- for commit in commits %}
{%- set username = commit.author.email | split(pat="@") | first | lower %}
{%- if username and username is not containing("bot") and username != "github-actions" and not username in usernames %}
{%- set_global usernames = usernames | concat(with=username) %}
{%- endif %}
{%- endfor %}
{% if usernames | length > 0 %}
## Contributors
{% for author in authors %}
* {{ author }}
{% for username in usernames | sort %}
* @{{ username }}
{%- endfor %}
{% endif %}
{% if server and repository and version %}