|
| 1 | +name: Build and Publish plugins |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + workspace: |
| 7 | + description: Plugin workspace to build |
| 8 | + required: true |
| 9 | + type: choice |
| 10 | + options: |
| 11 | + - backstage-1.42 |
| 12 | + - backstage-1.45 |
| 13 | + - backstage-1.49 |
| 14 | + - backstage-1.52 |
| 15 | + start: |
| 16 | + description: Start number of plugin instances (1-100) |
| 17 | + required: true |
| 18 | + default: 1 |
| 19 | + type: number |
| 20 | + end: |
| 21 | + description: End number of plugin instances (1-100) |
| 22 | + required: true |
| 23 | + default: 3 |
| 24 | + type: number |
| 25 | + |
| 26 | +permissions: |
| 27 | + contents: read |
| 28 | + |
| 29 | +jobs: |
| 30 | + build: |
| 31 | + runs-on: ubuntu-latest |
| 32 | + |
| 33 | + steps: |
| 34 | + - name: Harden runner |
| 35 | + uses: step-security/harden-runner@v2 |
| 36 | + with: |
| 37 | + egress-policy: audit |
| 38 | + |
| 39 | + - name: Validate inputs |
| 40 | + run: | |
| 41 | + start=${{ inputs.start }} |
| 42 | + end=${{ inputs.end }} |
| 43 | +
|
| 44 | + if [ "$start" -lt 1 ] || [ "$start" -gt 100 ]; then |
| 45 | + echo "::error::start must be between 1 and 100, got $start" |
| 46 | + exit 1 |
| 47 | + fi |
| 48 | +
|
| 49 | + if [ "$end" -lt 1 ] || [ "$end" -gt 100 ]; then |
| 50 | + echo "::error::end must be between 1 and 100, got $end" |
| 51 | + exit 1 |
| 52 | + fi |
| 53 | +
|
| 54 | + if [ "$start" -gt "$end" ]; then |
| 55 | + echo "::error::start ($start) must be less than or equal to end ($end)" |
| 56 | + exit 1 |
| 57 | + fi |
| 58 | +
|
| 59 | + - name: Checkout |
| 60 | + uses: actions/checkout@v7 |
| 61 | + |
| 62 | + - name: Setup Node.js |
| 63 | + uses: actions/setup-node@v4 |
| 64 | + with: |
| 65 | + node-version-file: plugins/${{ inputs.workspace }}/package.json |
| 66 | + |
| 67 | + - name: Install dependencies |
| 68 | + run: yarn install --immutable |
| 69 | + working-directory: plugins/${{ inputs.workspace }} |
| 70 | + |
| 71 | + - name: Build plugin instances |
| 72 | + run: | |
| 73 | + echo "Building plugin instance n" |
| 74 | + for i in $(seq ${{ inputs.start }} ${{ inputs.end }}); do |
| 75 | + echo "Building plugin instance $i" |
| 76 | + done |
| 77 | + echo "Reset to plugin instance n" |
| 78 | + working-directory: plugins/${{ inputs.workspace }} |
| 79 | + |
| 80 | + - name: Verify no changes in .github/ |
| 81 | + run: | |
| 82 | + if [ -n "$(git status --porcelain .github/)" ]; then |
| 83 | + echo "::error::Unexpected changes detected in .github/ after CI steps:" |
| 84 | + git diff .github/ |
| 85 | + exit 1 |
| 86 | + fi |
| 87 | + echo "No changes in .github/ — OK" |
0 commit comments