xref: /plugin/skillforge/.github/workflows/release.yml (revision b2a49f3b3fc9e4237528324740647c54125d68ef)
1name: Build and Release Plugin
2
3on:
4  push:
5    branches:
6      - main
7
8jobs:
9  build-release:
10    runs-on: ubuntu-latest
11    permissions:
12      contents: write
13
14    steps:
15      - uses: actions/checkout@v4
16
17      - name: Extract plugin name and version
18        id: plugin-info
19        run: |
20          PLUGIN_VERSION=$(grep "^version" plugin.info.txt | cut -d' ' -f2)
21          BUILD_DATE=$(date +%Y%m%d.%H%M%S)
22          TAG="v${PLUGIN_VERSION}-${BUILD_DATE}"
23          echo "version=${PLUGIN_VERSION}" >> $GITHUB_OUTPUT
24          echo "tag=${TAG}" >> $GITHUB_OUTPUT
25          echo "Plugin Version: ${PLUGIN_VERSION}, Tag: ${TAG}"
26
27      - name: Create plugin package
28        run: |
29          mkdir -p skillforge-package
30          # Copy all plugin files except git-related and excluded files
31          cp -r action.php admin.php helper.php syntax.php plugin.info.txt README.md LICENSE CHANGELOG.md style.css skillforge-package/
32          cp -r classes/ conf/ lang/ skillforge-package/
33
34          # Create ZIP archive with files at root level
35          cd skillforge-package
36          zip -r "../skillforge-${{ steps.plugin-info.outputs.version }}.zip" .
37          cd ..
38          ls -lh skillforge-*.zip
39          echo "RELEASE_FILE=skillforge-${{ steps.plugin-info.outputs.version }}.zip" >> $GITHUB_ENV
40
41      - name: Create Release
42        uses: softprops/action-gh-release@v2
43        with:
44          tag_name: ${{ steps.plugin-info.outputs.tag }}
45          name: SkillForge ${{ steps.plugin-info.outputs.version }}
46          body: |
47            ## SkillForge DokuWiki Plugin
48
49            **Version:** ${{ steps.plugin-info.outputs.version }}
50
51            ### Installation
52
53            1. Download the `skillforge-${{ steps.plugin-info.outputs.version }}.zip` file below
54            2. Extract it in your DokuWiki plugins directory: `lib/plugins/`
55            3. Go to Admin → SkillForge to configure
56
57            ### What's included
58            - Plugin core files (action.php, admin.php, helper.php, syntax.php)
59            - Configuration templates (conf/)
60            - Language files (lang/)
61            - Documentation (README.md, CHANGELOG.md)
62          files: |
63            ${{ env.RELEASE_FILE }}
64          draft: false
65          prerelease: false
66        env:
67          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68