-
Notifications
You must be signed in to change notification settings - Fork 27
75 lines (66 loc) · 2.18 KB
/
Copy pathrelease.yml
File metadata and controls
75 lines (66 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag:
description: "Tag name (e.g. v2.0.1)"
required: true
default: "v2.0.1"
env:
ARCHIVE_PREFIX: astrbot_plugin_jm_cosmos
jobs:
build-and-release:
name: Publish tagged release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Determine tag
id: prep
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
TAG="${{ github.event.inputs.tag }}"
REF="refs/tags/${TAG}"
else
TAG="${GITHUB_REF_NAME}"
REF="${GITHUB_REF}"
fi
echo "tag_name=${TAG}" >> "$GITHUB_OUTPUT"
echo "archive_name=${ARCHIVE_PREFIX}-${TAG}.zip" >> "$GITHUB_OUTPUT"
echo "checkout_ref=${REF}" >> "$GITHUB_OUTPUT"
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ steps.prep.outputs.checkout_ref }}
- name: Build release archive
env:
ARCHIVE_NAME: ${{ steps.prep.outputs.archive_name }}
run: |
# Create temp directory with plugin name
mkdir -p astrbot_plugin_jm_cosmos
# Copy files to temp directory (excluding unwanted files)
rsync -av --exclude='.git' \
--exclude='.github' \
--exclude='.venv' \
--exclude='__pycache__' \
--exclude='*.pyc' \
--exclude='.ruff_cache' \
--exclude='astrbot_plugin_jm_cosmos' \
. astrbot_plugin_jm_cosmos/
# Create zip with the directory as root
zip -r "$ARCHIVE_NAME" astrbot_plugin_jm_cosmos
# Cleanup
rm -rf astrbot_plugin_jm_cosmos
- name: Publish GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.prep.outputs.tag_name }}
name: JM-Cosmos ${{ steps.prep.outputs.tag_name }}
files: ${{ steps.prep.outputs.archive_name }}
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}