-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (55 loc) · 1.99 KB
/
Copy pathrelease.yml
File metadata and controls
65 lines (55 loc) · 1.99 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
name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-*'
jobs:
release:
runs-on: ubuntu-latest
environment: release
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Extract version from tag
id: version
run: |
VERSION=${GITHUB_REF_NAME#v}
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
# Mark as prerelease if version contains a hyphen (e.g. 0.3.0-rc.1)
if [[ "$VERSION" == *-* ]]; then
echo "prerelease=true" >> "$GITHUB_OUTPUT"
else
echo "prerelease=false" >> "$GITHUB_OUTPUT"
fi
# Build a distributable plugin ZIP.
# Kanboard's plugin installer expects a ZIP containing a single root
# directory named exactly after the plugin class: AssignColorsByDayOfWeek.
# This plugin has no production Composer dependencies (require-dev only),
# so vendor/ is intentionally excluded from the archive.
- name: Build plugin archive
run: |
ARCHIVE="AssignColorsByDayOfWeek-${{ steps.version.outputs.version }}.zip"
PLUGIN_DIR="AssignColorsByDayOfWeek"
mkdir -p "dist/$PLUGIN_DIR"
cp -r Action "dist/$PLUGIN_DIR/"
cp Plugin.php LICENSE README.md CHANGELOG.md composer.json "dist/$PLUGIN_DIR/"
cd dist
zip -r "../$ARCHIVE" "$PLUGIN_DIR/"
cd ..
echo "ARCHIVE=$ARCHIVE" >> "$GITHUB_ENV"
- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: |
PRERELEASE_FLAG=""
if [ "${{ steps.version.outputs.prerelease }}" = "true" ]; then
PRERELEASE_FLAG="--prerelease"
fi
gh release create "${{ github.ref_name }}" \
--title "${{ github.ref_name }}" \
--generate-notes \
$PRERELEASE_FLAG \
"$ARCHIVE"