|
| 1 | +--- |
| 2 | +name: "📦 Build .deb package for plugin" |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "main"] |
| 6 | + paths-ignore: |
| 7 | + - debian/changelog |
| 8 | + pull_request: |
| 9 | + branches: [ "main" ] |
| 10 | + paths-ignore: |
| 11 | + - debian/changelog |
| 12 | + |
| 13 | +jobs: |
| 14 | + build-deb-package: |
| 15 | + runs-on: ${{ matrix.os }} |
| 16 | + |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + os: [ubuntu-22.04] |
| 20 | + |
| 21 | + env: |
| 22 | + OS_VERSION: ${{ matrix.os }} |
| 23 | + defaults: |
| 24 | + run: |
| 25 | + working-directory: . |
| 26 | + steps: |
| 27 | + - name: Checkout source code |
| 28 | + uses: actions/checkout@v4 |
| 29 | + |
| 30 | + - name: Extract and print repository name |
| 31 | + run: | |
| 32 | + echo "REPO_NAME=$(echo ${{ github.repository }} | cut -d'/' -f2)" >> $GITHUB_ENV |
| 33 | +
|
| 34 | + - name: Set up Node.js |
| 35 | + run: | |
| 36 | + curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - |
| 37 | + sudo apt-get install -y nodejs |
| 38 | +
|
| 39 | + - name: Verify Node.js installation |
| 40 | + run: | |
| 41 | + node -v |
| 42 | + npm -v |
| 43 | +
|
| 44 | + - name: Install dependencies |
| 45 | + run: | |
| 46 | + sudo apt-get update |
| 47 | + sudo apt-get install -y devscripts debhelper |
| 48 | +
|
| 49 | + - name: Build Debian package |
| 50 | + run: | |
| 51 | + sudo dpkg-buildpackage -us -uc |
| 52 | +
|
| 53 | + - name: Create artifacts directory and move .deb files |
| 54 | + run: | |
| 55 | + mkdir -p artifacts |
| 56 | + mv ../*.deb artifacts/ || mv ./*.deb artifacts/ |
| 57 | + ls -la artifacts |
| 58 | +
|
| 59 | + - name: Upload Debian Package |
| 60 | + uses: actions/upload-artifact@v4 |
| 61 | + with: |
| 62 | + name: "${{ env.REPO_NAME }}-${{ env.OS_VERSION }}" |
| 63 | + path: artifacts/*.deb |
| 64 | + |
| 65 | + release: |
| 66 | + name: "Upload assets to release" |
| 67 | + needs: build-deb-package |
| 68 | + runs-on: ${{ matrix.os }} |
| 69 | + |
| 70 | + strategy: |
| 71 | + matrix: |
| 72 | + os: [ubuntu-22.04] |
| 73 | + |
| 74 | + env: |
| 75 | + OS_VERSION: ${{ matrix.os }} |
| 76 | + if: ${{ github.ref_type == 'tag' }} |
| 77 | + permissions: |
| 78 | + contents: write |
| 79 | + actions: read |
| 80 | + steps: |
| 81 | + - uses: actions/checkout@v4 |
| 82 | + |
| 83 | + - name: Extract and print repository name |
| 84 | + run: | |
| 85 | + echo "REPO_NAME=$(echo ${{ github.repository }} | cut -d'/' -f2)" >> $GITHUB_ENV |
| 86 | +
|
| 87 | + - uses: actions/download-artifact@v4 |
| 88 | + with: |
| 89 | + name: "${{ env.REPO_NAME }}-${{ env.OS_VERSION }}" |
| 90 | + path: "${{ env.REPO_NAME }}-${{ env.OS_VERSION }}" |
| 91 | + |
| 92 | + - name: Create release asset archives |
| 93 | + run: zip --junk-paths --recurse-paths --compression-method store "${{ env.REPO_NAME }}-${{ env.OS_VERSION }}.zip" "${{ env.REPO_NAME }}-${{ env.OS_VERSION }}" |
| 94 | + |
| 95 | + - name: Upload release assets |
| 96 | + env: |
| 97 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 98 | + run: gh release upload ${{ github.ref_name }} "${{ env.REPO_NAME }}-${{ env.OS_VERSION }}.zip" |
| 99 | + |
0 commit comments