|
1 | | -name: Compose Plugin CI |
2 | | - |
3 | | -on: |
4 | | - push: |
5 | | - tags: [ '20[0-9]+.[0-9]+.[0-9]' ] |
6 | | - workflow_dispatch: |
7 | | - inputs: |
8 | | - create_release: |
9 | | - description: 'Create a Release T/F' |
10 | | - version_letter: |
11 | | - description: 'Additional Letter to add to the version' |
12 | | - |
13 | | -jobs: |
14 | | - build: |
15 | | - runs-on: ubuntu-latest |
16 | | - defaults: |
17 | | - run: |
18 | | - shell: bash |
19 | | - steps: |
20 | | - - name: Checkout |
21 | | - uses: actions/checkout@v2 |
22 | | - |
23 | | - - name: Get current date |
24 | | - id: date |
25 | | - run: echo "::set-output name=date::$(date +'%Y.%m.%d')" |
26 | | - |
27 | | - - name: Set Pre-Build ENV Variables |
28 | | - if: github.event.inputs.version_letter |
29 | | - run: | |
30 | | - echo "UI_VERSION_LETTER=${{github.event.inputs.version_letter}}" >> $GITHUB_ENV |
31 | | - |
32 | | - - name: Build the in Docker |
33 | | - run: | |
34 | | - chmod +x ./build_in_docker.sh |
35 | | - chmod +x ./source/pkg_build.sh |
36 | | - ./build_in_docker.sh -u |
37 | | - |
38 | | - - name: Set Post-Build ENV Variables |
39 | | - id: version |
40 | | - run: echo "::set-output name=version::${{steps.date.outputs.date}}${{env.UI_VERSION_LETTER}}" |
41 | | - |
42 | | - - name: Upload Artifact |
43 | | - uses: actions/upload-artifact@v4 |
44 | | - with: |
45 | | - name: compose.manager-package-${{steps.version.outputs.version}}.txz |
46 | | - path: ./archive/compose.manager-package-* |
47 | | - |
48 | | - - name: Set Release ENV Variables On Manual |
49 | | - if: github.event_name == 'workflow_dispatch' |
50 | | - run: | |
51 | | - echo "DO_RELEASE=${{github.event.inputs.create_release}}" >> $GITHUB_ENV |
52 | | - echo "RELEASE_TAG_NAME=${{steps.version.outputs.version}}" >> $GITHUB_ENV |
53 | | - |
54 | | - - name: Set Release ENV Variables On Auto |
55 | | - if: github.event_name != 'workflow_dispatch' |
56 | | - run: | |
57 | | - echo "DO_RELEASE=T" >> $GITHUB_ENV |
58 | | - echo "RELEASE_TAG_NAME=${{github.GITHUB_REF}}" >> $GITHUB_ENV |
59 | | - |
60 | | - - name: Create Manual Release |
61 | | - id: create_release |
62 | | - uses: actions/create-release@v1 |
63 | | - if: env.DO_RELEASE == 'T' |
64 | | - env: |
65 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
66 | | - with: |
67 | | - tag_name: ${{env.RELEASE_TAG_NAME}} |
68 | | - release_name: Compose Manager Package ${{env.RELEASE_TAG_NAME}} |
69 | | - body_path: ./archive/release_info |
70 | | - draft: true |
71 | | - prerelease: false |
72 | | - |
73 | | - - name: Upload Release Asset |
74 | | - id: upload-release-asset |
75 | | - uses: actions/upload-release-asset@v1 |
76 | | - if: env.DO_RELEASE == 'T' |
77 | | - env: |
78 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
79 | | - with: |
80 | | - upload_url: ${{ steps.create_release.outputs.upload_url }} |
81 | | - asset_path: ./archive/compose.manager-package-${{steps.version.outputs.version}}.txz |
82 | | - asset_name: compose.manager-package-${{steps.version.outputs.version}}.txz |
83 | | - asset_content_type: application/octet-stream |
| 1 | +# .github/workflows/build.yml |
| 2 | +# CI/CD pipeline for Compose Manager plugin |
| 3 | +# |
| 4 | +# This workflow automates the release process: |
| 5 | +# - Builds TXZ package using Docker (Slackware) |
| 6 | +# - Calculates MD5 for integrity verification |
| 7 | +# - Creates GitHub releases with package attached |
| 8 | +# - Updates PLG file in dev branch |
| 9 | +# |
| 10 | +# Triggers: |
| 11 | +# - New tag matching date pattern: vYYYY.MM.DD[a-z] |
| 12 | +# - Manual workflow_dispatch for testing builds |
| 13 | + |
| 14 | +name: Build & Release Plugin |
| 15 | + |
| 16 | +on: |
| 17 | + push: |
| 18 | + tags: |
| 19 | + - 'v20[0-9][0-9].[0-9][0-9].[0-9][0-9]*' |
| 20 | + workflow_dispatch: |
| 21 | + inputs: |
| 22 | + version: |
| 23 | + description: 'Version to build (e.g., 2026.02.01) - leave empty for test build' |
| 24 | + required: false |
| 25 | + default: '' |
| 26 | + |
| 27 | +permissions: |
| 28 | + contents: write |
| 29 | + |
| 30 | +env: |
| 31 | + PLUGIN_NAME: compose.manager |
| 32 | + COMPOSE_VERSION: '2.40.3' |
| 33 | + COMPOSE_SWITCH_VERSION: '1.0.5' |
| 34 | + ACE_VERSION: '1.4.14' |
| 35 | + |
| 36 | +jobs: |
| 37 | + build: |
| 38 | + runs-on: ubuntu-latest |
| 39 | + outputs: |
| 40 | + version: ${{ steps.version.outputs.VERSION }} |
| 41 | + md5: ${{ steps.hash.outputs.MD5 }} |
| 42 | + |
| 43 | + steps: |
| 44 | + - name: Checkout repository |
| 45 | + uses: actions/checkout@v4 |
| 46 | + with: |
| 47 | + fetch-depth: 0 |
| 48 | + |
| 49 | + - name: Determine version |
| 50 | + id: version |
| 51 | + run: | |
| 52 | + if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == refs/tags/v* ]]; then |
| 53 | + # Release tag - extract version (remove 'v' prefix) |
| 54 | + VERSION="${GITHUB_REF#refs/tags/v}" |
| 55 | + elif [[ -n "${{ github.event.inputs.version }}" ]]; then |
| 56 | + # Manual input |
| 57 | + VERSION="${{ github.event.inputs.version }}" |
| 58 | + else |
| 59 | + # Test build - use date + git SHA |
| 60 | + VERSION="$(date +%Y.%m.%d)-dev.$(git rev-parse --short HEAD)" |
| 61 | + fi |
| 62 | + echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT |
| 63 | + echo "Building version: ${VERSION}" |
| 64 | +
|
| 65 | + - name: Build TXZ package in Docker |
| 66 | + run: | |
| 67 | + VERSION="${{ steps.version.outputs.VERSION }}" |
| 68 | + |
| 69 | + # Set executable permissions |
| 70 | + chmod +x ./build_in_docker.sh |
| 71 | + chmod +x ./source/pkg_build.sh |
| 72 | + |
| 73 | + # Build using the Slackware Docker container |
| 74 | + docker run --rm --tmpfs /tmp \ |
| 75 | + -v $PWD/archive:/mnt/output:rw \ |
| 76 | + -v $PWD/source:/mnt/source:ro \ |
| 77 | + -e TZ="America/New_York" \ |
| 78 | + -e COMPOSE_VERSION=${{ env.COMPOSE_VERSION }} \ |
| 79 | + -e COMPOSE_SWITCH_VERSION=${{ env.COMPOSE_SWITCH_VERSION }} \ |
| 80 | + -e ACE_VERSION=${{ env.ACE_VERSION }} \ |
| 81 | + -e OUTPUT_FOLDER="/mnt/output" \ |
| 82 | + -e PKG_VERSION="${VERSION}" \ |
| 83 | + vbatts/slackware:latest /mnt/source/pkg_build.sh |
| 84 | + |
| 85 | + # Verify package was created |
| 86 | + ls -la ./archive/ |
| 87 | + if [[ ! -f "./archive/${{ env.PLUGIN_NAME }}-package-${VERSION}.txz" ]]; then |
| 88 | + echo "ERROR: Package not found!" |
| 89 | + exit 1 |
| 90 | + fi |
| 91 | +
|
| 92 | + - name: Calculate hash |
| 93 | + id: hash |
| 94 | + run: | |
| 95 | + VERSION="${{ steps.version.outputs.VERSION }}" |
| 96 | + PACKAGE="./archive/${{ env.PLUGIN_NAME }}-package-${VERSION}.txz" |
| 97 | + |
| 98 | + MD5=$(md5sum "$PACKAGE" | cut -d' ' -f1) |
| 99 | + echo "MD5=${MD5}" >> $GITHUB_OUTPUT |
| 100 | + echo "Package MD5: ${MD5}" |
| 101 | +
|
| 102 | + - name: Upload build artifacts |
| 103 | + uses: actions/upload-artifact@v4 |
| 104 | + with: |
| 105 | + name: plugin-package |
| 106 | + path: | |
| 107 | + archive/*.txz |
| 108 | + archive/release_info |
| 109 | + retention-days: 30 |
| 110 | + |
| 111 | + release: |
| 112 | + needs: build |
| 113 | + runs-on: ubuntu-latest |
| 114 | + if: startsWith(github.ref, 'refs/tags/v') |
| 115 | + |
| 116 | + steps: |
| 117 | + - name: Checkout repository |
| 118 | + uses: actions/checkout@v4 |
| 119 | + with: |
| 120 | + ref: dev |
| 121 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 122 | + |
| 123 | + - name: Download artifacts |
| 124 | + uses: actions/download-artifact@v4 |
| 125 | + with: |
| 126 | + name: plugin-package |
| 127 | + path: artifacts/ |
| 128 | + |
| 129 | + - name: Prepare release notes |
| 130 | + id: notes |
| 131 | + run: | |
| 132 | + VERSION="${{ needs.build.outputs.version }}" |
| 133 | + |
| 134 | + # Read component versions from release_info |
| 135 | + if [[ -f artifacts/archive/release_info ]]; then |
| 136 | + COMPONENTS=$(cat artifacts/archive/release_info) |
| 137 | + else |
| 138 | + COMPONENTS="Compose v${{ env.COMPOSE_VERSION }}" |
| 139 | + fi |
| 140 | + |
| 141 | + # Create release body |
| 142 | + cat > release_body.md << EOF |
| 143 | + ## Compose Manager v${VERSION} |
| 144 | + |
| 145 | + ### Installation |
| 146 | + |
| 147 | + **Via Plugin Manager:** |
| 148 | + \`\`\` |
| 149 | + https://raw.githubusercontent.com/${{ github.repository }}/dev/${{ env.PLUGIN_NAME }}.plg |
| 150 | + \`\`\` |
| 151 | + |
| 152 | + ### Package Details |
| 153 | + - **MD5:** \`${{ needs.build.outputs.md5 }}\` |
| 154 | + |
| 155 | + ### Components |
| 156 | + ${COMPONENTS} |
| 157 | + EOF |
| 158 | +
|
| 159 | + - name: Create GitHub Release |
| 160 | + uses: softprops/action-gh-release@v2 |
| 161 | + with: |
| 162 | + name: "Compose Manager v${{ needs.build.outputs.version }}" |
| 163 | + body_path: release_body.md |
| 164 | + files: | |
| 165 | + artifacts/archive/*.txz |
| 166 | + fail_on_unmatched_files: true |
| 167 | + draft: false |
| 168 | + prerelease: false |
| 169 | + env: |
| 170 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 171 | + |
| 172 | + - name: Update PLG in dev branch |
| 173 | + run: | |
| 174 | + VERSION="${{ needs.build.outputs.version }}" |
| 175 | + MD5="${{ needs.build.outputs.md5 }}" |
| 176 | + |
| 177 | + # Configure git |
| 178 | + git config user.name "github-actions[bot]" |
| 179 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 180 | + |
| 181 | + # Update version and MD5 in PLG |
| 182 | + sed -i \ |
| 183 | + -e "s|<!ENTITY version.*\".*\"|<!ENTITY version \"${VERSION}\"|" \ |
| 184 | + -e "s|<!ENTITY packageMD5.*\".*\"|<!ENTITY packageMD5 \"${MD5}\"|" \ |
| 185 | + ${{ env.PLUGIN_NAME }}.plg |
| 186 | + |
| 187 | + echo "Updated PLG file:" |
| 188 | + head -20 ${{ env.PLUGIN_NAME }}.plg |
| 189 | + |
| 190 | + # Commit and push |
| 191 | + git add ${{ env.PLUGIN_NAME }}.plg |
| 192 | + git commit -m "Release v${VERSION}" || echo "No changes to commit" |
| 193 | + git push origin dev |
0 commit comments