Skip to content

Commit 4e16fc2

Browse files
committed
Modify release configureations.
1 parent 1db6bab commit 4e16fc2

17 files changed

Lines changed: 1194 additions & 71 deletions

.github/workflows/rpgkit-lint.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: RPG-Kit Lint
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
push:
8+
branches: [main]
9+
paths:
10+
- "RPG-Kit/**"
11+
- ".github/workflows/rpgkit-*.yml"
12+
- ".github/workflows/scripts/rpgkit/**"
13+
- ".markdownlint-cli2.jsonc"
14+
pull_request:
15+
paths:
16+
- "RPG-Kit/**"
17+
- ".github/workflows/rpgkit-*.yml"
18+
- ".github/workflows/scripts/rpgkit/**"
19+
- ".markdownlint-cli2.jsonc"
20+
workflow_dispatch:
21+
22+
jobs:
23+
markdownlint:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
29+
- name: Run markdownlint-cli2
30+
uses: DavidAnson/markdownlint-cli2-action@v19
31+
with:
32+
globs: |
33+
RPG-Kit/**/*.md
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: RPG-Kit Pre-Release
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
- "dev/**"
8+
paths:
9+
- "RPG-Kit/**"
10+
- ".github/workflows/rpgkit-pre-release.yml"
11+
- ".github/workflows/scripts/rpgkit/**"
12+
workflow_dispatch:
13+
14+
jobs:
15+
pre-release:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: write
19+
pull-requests: write
20+
env:
21+
PROJECT_DIR: RPG-Kit
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
token: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Prepare scripts
30+
run: chmod +x .github/workflows/scripts/rpgkit/*.sh
31+
32+
- name: Get RPG-Kit pre-release version
33+
id: get_tag
34+
run: .github/workflows/scripts/rpgkit/get-next-pre-version.sh "${{ github.run_number }}"
35+
36+
- name: Check if release already exists
37+
id: check_release
38+
run: .github/workflows/scripts/rpgkit/check-release-exists.sh "${{ steps.get_tag.outputs.tag_name }}"
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
42+
- name: Create release package variants
43+
if: steps.check_release.outputs.exists == 'false'
44+
run: .github/workflows/scripts/rpgkit/create-release-packages.sh "${{ steps.get_tag.outputs.new_version }}"
45+
46+
- name: Generate release notes
47+
if: steps.check_release.outputs.exists == 'false'
48+
run: .github/workflows/scripts/rpgkit/generate-release-notes.sh "${{ steps.get_tag.outputs.new_version }}" "${{ steps.get_tag.outputs.latest_tag }}" pre
49+
50+
- name: Create GitHub pre-release
51+
if: steps.check_release.outputs.exists == 'false'
52+
run: .github/workflows/scripts/rpgkit/create-github-release.sh "${{ steps.get_tag.outputs.new_version }}" "${{ steps.get_tag.outputs.tag_name }}" pre
53+
env:
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: RPG-Kit Release
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- "RPG-Kit/**"
8+
- ".github/workflows/rpgkit-release.yml"
9+
- ".github/workflows/scripts/rpgkit/**"
10+
workflow_dispatch:
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
pull-requests: write
18+
env:
19+
PROJECT_DIR: RPG-Kit
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
token: ${{ secrets.GITHUB_TOKEN }}
26+
27+
- name: Prepare scripts
28+
run: chmod +x .github/workflows/scripts/rpgkit/*.sh
29+
30+
- name: Get next RPG-Kit version
31+
id: get_tag
32+
run: .github/workflows/scripts/rpgkit/get-next-version.sh
33+
34+
- name: Check if release already exists
35+
id: check_release
36+
run: .github/workflows/scripts/rpgkit/check-release-exists.sh "${{ steps.get_tag.outputs.tag_name }}"
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- name: Update version in pyproject.toml
41+
if: steps.check_release.outputs.exists == 'false'
42+
run: .github/workflows/scripts/rpgkit/update-version.sh "${{ steps.get_tag.outputs.new_version }}"
43+
44+
- name: Create release package variants
45+
if: steps.check_release.outputs.exists == 'false'
46+
run: .github/workflows/scripts/rpgkit/create-release-packages.sh "${{ steps.get_tag.outputs.new_version }}"
47+
48+
- name: Generate release notes
49+
if: steps.check_release.outputs.exists == 'false'
50+
run: .github/workflows/scripts/rpgkit/generate-release-notes.sh "${{ steps.get_tag.outputs.new_version }}" "${{ steps.get_tag.outputs.latest_tag }}" stable
51+
52+
- name: Create GitHub release
53+
if: steps.check_release.outputs.exists == 'false'
54+
run: .github/workflows/scripts/rpgkit/create-github-release.sh "${{ steps.get_tag.outputs.new_version }}" "${{ steps.get_tag.outputs.tag_name }}" stable
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
if [[ $# -ne 1 ]]; then
5+
echo "Usage: $0 <tag_name>" >&2
6+
exit 1
7+
fi
8+
9+
TAG_NAME="$1"
10+
11+
write_output() {
12+
[[ -n "${GITHUB_OUTPUT:-}" ]] && echo "$1" >> "$GITHUB_OUTPUT"
13+
}
14+
15+
if gh release view "$TAG_NAME" >/dev/null 2>&1; then
16+
write_output "exists=true"
17+
echo "Release $TAG_NAME already exists, skipping..."
18+
else
19+
write_output "exists=false"
20+
echo "Release $TAG_NAME does not exist, proceeding..."
21+
fi
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
if [[ $# -lt 2 || $# -gt 3 ]]; then
5+
echo "Usage: $0 <version> <tag_name> [stable|pre]" >&2
6+
exit 1
7+
fi
8+
9+
VERSION="$1"
10+
TAG_NAME="$2"
11+
RELEASE_KIND="${3:-stable}"
12+
VERSION_NO_V="${VERSION#v}"
13+
REPO_ROOT="${GITHUB_WORKSPACE:-$(git rev-parse --show-toplevel)}"
14+
PROJECT_DIR="${PROJECT_DIR:-RPG-Kit}"
15+
PROJECT_ROOT="$REPO_ROOT/$PROJECT_DIR"
16+
GENRELEASES_DIR="$PROJECT_ROOT/.genreleases"
17+
NOTES_FILE="${NOTES_FILE:-$REPO_ROOT/release_notes.md}"
18+
19+
mapfile -t ASSETS < <(find "$GENRELEASES_DIR" -maxdepth 1 -type f -name "rpgkit-template-*-${VERSION}.zip" | sort)
20+
if [[ ${#ASSETS[@]} -eq 0 ]]; then
21+
echo "No release assets found in $GENRELEASES_DIR for $VERSION" >&2
22+
exit 1
23+
fi
24+
25+
PRERELEASE_ARG=()
26+
if [[ "$RELEASE_KIND" == "pre" ]]; then
27+
PRERELEASE_ARG=(--prerelease)
28+
fi
29+
30+
TARGET_ARG=()
31+
if [[ -n "${GITHUB_SHA:-}" ]]; then
32+
TARGET_ARG=(--target "$GITHUB_SHA")
33+
fi
34+
35+
gh release create "$TAG_NAME" \
36+
"${ASSETS[@]}" \
37+
--title "RPG-Kit Templates - $VERSION_NO_V" \
38+
--notes-file "$NOTES_FILE" \
39+
"${PRERELEASE_ARG[@]}" \
40+
"${TARGET_ARG[@]}"

0 commit comments

Comments
 (0)