|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: |
| 4 | + repository_dispatch: |
| 5 | + types: [Build] |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +jobs: |
| 9 | + build-public: |
| 10 | + if: > |
| 11 | + github.event.repository.visibility == 'public' && |
| 12 | + github.event_name == 'repository_dispatch' && |
| 13 | + github.event.client_payload.tag != '' |
| 14 | + runs-on: ubuntu-latest |
| 15 | + permissions: |
| 16 | + contents: write |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v5 |
| 19 | + with: |
| 20 | + ref: ${{ github.event.client_payload.tag }} |
| 21 | + |
| 22 | + - name: Setup Node.js |
| 23 | + uses: actions/setup-node@v4 |
| 24 | + with: |
| 25 | + node-version: '20' |
| 26 | + |
| 27 | + - name: Create package |
| 28 | + run: | |
| 29 | + rm -rf *.tar.gz |
| 30 | + npx --yes wspackager@latest |
| 31 | +
|
| 32 | + - name: Check file existence |
| 33 | + id: check_files |
| 34 | + uses: andstor/file-existence-action@v3 |
| 35 | + with: |
| 36 | + files: "*.tar.gz" |
| 37 | + |
| 38 | + - name: On Build Failure |
| 39 | + if: steps.check_files.outputs.files_exists == 'false' |
| 40 | + run: | |
| 41 | + echo "Packaging FAILED" && exit 1 |
| 42 | +
|
| 43 | + - name: Set Release Tag |
| 44 | + id: set_release_tag |
| 45 | + run: | |
| 46 | + echo "release_tag=${{ github.event.client_payload.tag }}" >> $GITHUB_ENV |
| 47 | +
|
| 48 | + - name: Release Build |
| 49 | + if: env.release_tag != 'unknown' && steps.check_files.outputs.files_exists == 'true' |
| 50 | + uses: softprops/action-gh-release@v2 |
| 51 | + with: |
| 52 | + tag_name: ${{ env.release_tag }} |
| 53 | + files: "*.tar.gz" |
| 54 | + |
| 55 | + build-private: |
| 56 | + if: > |
| 57 | + github.event.repository.visibility != 'public' && |
| 58 | + github.event_name == 'repository_dispatch' && |
| 59 | + github.event.client_payload.tag != '' |
| 60 | + runs-on: self-hosted |
| 61 | + permissions: |
| 62 | + contents: write |
| 63 | + steps: |
| 64 | + - uses: actions/checkout@v5 |
| 65 | + with: |
| 66 | + ref: ${{ github.event.client_payload.tag }} |
| 67 | + |
| 68 | + - name: Setup Node.js |
| 69 | + uses: actions/setup-node@v5 |
| 70 | + with: |
| 71 | + node-version: '20' |
| 72 | + |
| 73 | + - name: Create package |
| 74 | + run: | |
| 75 | + rm -rf *.tar.gz |
| 76 | + npx --yes wspackager@latest |
| 77 | +
|
| 78 | + - name: Check file existence |
| 79 | + id: check_files |
| 80 | + uses: andstor/file-existence-action@v3 |
| 81 | + with: |
| 82 | + files: "*.tar.gz" |
| 83 | + |
| 84 | + - name: On Build Failure |
| 85 | + if: steps.check_files.outputs.files_exists == 'false' |
| 86 | + run: | |
| 87 | + echo "Packaging FAILED" && exit 1 |
| 88 | +
|
| 89 | + - name: Set Release Tag |
| 90 | + id: set_release_tag |
| 91 | + run: | |
| 92 | + echo "release_tag=${{ github.event.client_payload.tag }}" >> $GITHUB_ENV |
| 93 | +
|
| 94 | + - name: Release Build |
| 95 | + if: env.release_tag != 'unknown' && steps.check_files.outputs.files_exists == 'true' |
| 96 | + uses: softprops/action-gh-release@v2 |
| 97 | + with: |
| 98 | + tag_name: ${{ env.release_tag }} |
| 99 | + files: "*.tar.gz" |
0 commit comments