Skip to content

Commit 61d0f6f

Browse files
committed
Workflow
1 parent 6abbb48 commit 61d0f6f

1 file changed

Lines changed: 15 additions & 13 deletions

File tree

.github/workflows/release.yml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ permissions:
1414
jobs:
1515
check-and-release:
1616
runs-on: ubuntu-latest
17+
env:
18+
PLUGIN_FILE: enginescript-site-exporter.php
19+
PLUGIN_SLUG: enginescript-site-exporter
1720
steps:
1821
- name: Checkout code
1922
uses: actions/checkout@v6
@@ -23,7 +26,7 @@ jobs:
2326
- name: Get latest version
2427
id: get_version
2528
run: |
26-
VERSION=$(grep -oP "Version: \K[0-9]+\.[0-9]+\.[0-9]+" enginescript-site-exporter.php)
29+
VERSION=$(grep -oP "Version: \K[0-9]+\.[0-9]+\.[0-9]+" "$PLUGIN_FILE")
2730
echo "version=$VERSION" >> $GITHUB_OUTPUT
2831
echo "Found version: $VERSION"
2932
@@ -47,7 +50,6 @@ jobs:
4750
run: |
4851
README_FILE="README.md"
4952
TMP_FILE=$(mktemp)
50-
PLUGIN_SLUG="enginescript-site-exporter"
5153
5254
# Update the version badge with the new version and logo
5355
sed -E "s#\[!\[Version\]\(https://img\.shields\.io/badge/Version-[0-9]+\.[0-9]+\.[0-9]+-orange\.svg\?logo=github\)\]\(https://github\.com/[^/]+/${PLUGIN_SLUG}/releases/(latest/download|download/v[0-9]+\.[0-9]+\.[0-9]+)/${PLUGIN_SLUG}-[0-9]+\.[0-9]+\.[0-9]+\.zip\)#[![Version](https://img.shields.io/badge/Version-${VERSION}-orange.svg?logo=github)](https://github.com/${{ github.repository }}/releases/latest/download/${PLUGIN_SLUG}-${VERSION}.zip)#g" "$README_FILE" > "$TMP_FILE"
@@ -77,16 +79,16 @@ jobs:
7779
- name: Create zip file
7880
if: steps.check_release.outputs.exists == 'false'
7981
run: |
80-
rm -rf enginescript-site-exporter
81-
mkdir -p enginescript-site-exporter
82-
cp enginescript-site-exporter.php enginescript-site-exporter/
83-
cp -r includes enginescript-site-exporter/
84-
cp -r css enginescript-site-exporter/
85-
cp -r js enginescript-site-exporter/
86-
cp -r languages enginescript-site-exporter/
87-
cp readme.txt enginescript-site-exporter/
88-
cp LICENSE enginescript-site-exporter/ || echo "No LICENSE file found"
89-
zip -r enginescript-site-exporter-${{ steps.get_version.outputs.version }}.zip enginescript-site-exporter
82+
rm -rf "$PLUGIN_SLUG"
83+
mkdir -p "$PLUGIN_SLUG"
84+
cp "$PLUGIN_FILE" "$PLUGIN_SLUG/"
85+
cp -r includes "$PLUGIN_SLUG/"
86+
cp -r css "$PLUGIN_SLUG/"
87+
cp -r js "$PLUGIN_SLUG/"
88+
cp -r languages "$PLUGIN_SLUG/"
89+
cp readme.txt "$PLUGIN_SLUG/"
90+
cp LICENSE "$PLUGIN_SLUG/" || echo "No LICENSE file found"
91+
zip -r "${PLUGIN_SLUG}-${{ steps.get_version.outputs.version }}.zip" "$PLUGIN_SLUG"
9092
9193
- name: Get changelog entry
9294
if: steps.check_release.outputs.exists == 'false'
@@ -112,7 +114,7 @@ jobs:
112114
3. Activate the plugin
113115
114116
[Full Documentation](https://github.com/${{ github.repository }})
115-
files: enginescript-site-exporter-${{ steps.get_version.outputs.version }}.zip
117+
files: ${{ env.PLUGIN_SLUG }}-${{ steps.get_version.outputs.version }}.zip
116118
draft: false
117119
prerelease: false
118120
generate_release_notes: false

0 commit comments

Comments
 (0)