|
1 | | -name: Create Release on PR Merge |
| 1 | +name: PR Merge Pipeline |
2 | 2 |
|
3 | 3 | on: |
4 | | - workflow_run: |
5 | | - workflows: ["Update Plugin Data"] |
| 4 | + pull_request: |
6 | 5 | types: |
7 | | - - completed |
| 6 | + - closed |
8 | 7 | branches: |
9 | 8 | - main |
| 9 | + workflow_dispatch: # Allow manual trigger |
10 | 10 |
|
11 | 11 | jobs: |
| 12 | + update-data: |
| 13 | + # Only run if the PR was merged (not just closed) |
| 14 | + if: github.event.pull_request.merged == true |
| 15 | + runs-on: ubuntu-latest |
| 16 | + permissions: |
| 17 | + contents: write |
| 18 | + |
| 19 | + steps: |
| 20 | + - name: Checkout repository |
| 21 | + uses: actions/checkout@v5 |
| 22 | + |
| 23 | + - name: Install uv |
| 24 | + uses: astral-sh/setup-uv@v7 |
| 25 | + |
| 26 | + - name: Set up Python |
| 27 | + run: uv python install |
| 28 | + |
| 29 | + - name: Sync plugin metadata |
| 30 | + run: uv run sync |
| 31 | + |
| 32 | + - name: Get README files |
| 33 | + run: uv run get-readme |
| 34 | + |
| 35 | + - name: Check for changes |
| 36 | + id: git-check |
| 37 | + run: | |
| 38 | + git diff --exit-code || echo "has_changes=true" >> $GITHUB_OUTPUT |
| 39 | +
|
| 40 | + - name: Commit and push changes |
| 41 | + if: steps.git-check.outputs.has_changes == 'true' |
| 42 | + run: | |
| 43 | + git config --local user.email "github-actions[bot]@users.noreply.github.com" |
| 44 | + git config --local user.name "github-actions[bot]" |
| 45 | + git add . |
| 46 | + git commit -m "chore: update plugin metadata and READMEs [automated]" |
| 47 | + git push |
| 48 | +
|
| 49 | + - name: No changes detected |
| 50 | + if: steps.git-check.outputs.has_changes != 'true' |
| 51 | + run: echo "No changes to commit" |
| 52 | + |
12 | 53 | create-release: |
13 | | - # Only run if the update workflow succeeded |
14 | | - if: ${{ github.event.workflow_run.conclusion == 'success' }} |
| 54 | + # Only run after update-data job completes successfully |
| 55 | + needs: update-data |
15 | 56 | runs-on: ubuntu-latest |
16 | 57 | permissions: |
17 | 58 | contents: write |
18 | | - |
| 59 | + |
19 | 60 | steps: |
20 | 61 | - name: Checkout repository |
21 | 62 | uses: actions/checkout@v5 |
22 | 63 | with: |
23 | 64 | ref: main |
24 | | - |
| 65 | + |
25 | 66 | - name: Generate release tag |
26 | 67 | id: tag |
27 | 68 | run: | |
28 | 69 | # Generate CalVer format: YY.MM.DD |
29 | 70 | CALVER=$(date +'%y.%m.%d') |
30 | | - |
| 71 | +
|
31 | 72 | # Check if a release with this CalVer already exists |
32 | 73 | COUNTER=0 |
33 | 74 | TAG="$CALVER" |
34 | | - |
| 75 | +
|
35 | 76 | # Fetch existing tags |
36 | 77 | git fetch --tags |
37 | | - |
| 78 | +
|
38 | 79 | # Find the highest counter for today's releases |
39 | 80 | while git rev-parse "refs/tags/$TAG" >/dev/null 2>&1; do |
40 | 81 | COUNTER=$((COUNTER + 1)) |
41 | 82 | TAG="$CALVER.$COUNTER" |
42 | 83 | done |
43 | | - |
| 84 | +
|
44 | 85 | echo "tag=$TAG" >> $GITHUB_OUTPUT |
45 | 86 | echo "Generated tag: $TAG" |
46 | | - |
| 87 | +
|
47 | 88 | - name: Create zip archives |
48 | 89 | run: | |
49 | 90 | zip -r plugins.zip plugins/ |
50 | 91 | zip -r readmes.zip readmes/ |
51 | 92 | zip -r plugins-and-readmes.zip plugins/ readmes/ |
52 | | - |
| 93 | +
|
53 | 94 | - name: Create Release |
54 | 95 | uses: softprops/action-gh-release@v2 |
55 | 96 | with: |
56 | 97 | tag_name: ${{ steps.tag.outputs.tag }} |
57 | 98 | name: Release ${{ steps.tag.outputs.tag }} |
58 | 99 | body: | |
59 | 100 | Automatic release created from PR merge |
60 | | - |
| 101 | +
|
61 | 102 | **PR**: #${{ github.event.pull_request.number }} - ${{ github.event.pull_request.title }} |
62 | 103 | **Merged by**: @${{ github.event.pull_request.merged_by.login }} |
63 | 104 | **Commit**: ${{ github.sha }} |
|
0 commit comments