Skip to content

Commit 8c930c3

Browse files
authored
Merge pull request #3 from litestar-org/ci/test-pr-1
ci: merged workflow into a single file
2 parents 68d3a24 + dd720ab commit 8c930c3

File tree

2 files changed

+56
-66
lines changed

2 files changed

+56
-66
lines changed

.github/workflows/create-release-on-merge.yml renamed to .github/workflows/pr-merge-pipeline.yml

Lines changed: 56 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,104 @@
1-
name: Create Release on PR Merge
1+
name: PR Merge Pipeline
22

33
on:
4-
workflow_run:
5-
workflows: ["Update Plugin Data"]
4+
pull_request:
65
types:
7-
- completed
6+
- closed
87
branches:
98
- main
9+
workflow_dispatch: # Allow manual trigger
1010

1111
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+
1253
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
1556
runs-on: ubuntu-latest
1657
permissions:
1758
contents: write
18-
59+
1960
steps:
2061
- name: Checkout repository
2162
uses: actions/checkout@v5
2263
with:
2364
ref: main
24-
65+
2566
- name: Generate release tag
2667
id: tag
2768
run: |
2869
# Generate CalVer format: YY.MM.DD
2970
CALVER=$(date +'%y.%m.%d')
30-
71+
3172
# Check if a release with this CalVer already exists
3273
COUNTER=0
3374
TAG="$CALVER"
34-
75+
3576
# Fetch existing tags
3677
git fetch --tags
37-
78+
3879
# Find the highest counter for today's releases
3980
while git rev-parse "refs/tags/$TAG" >/dev/null 2>&1; do
4081
COUNTER=$((COUNTER + 1))
4182
TAG="$CALVER.$COUNTER"
4283
done
43-
84+
4485
echo "tag=$TAG" >> $GITHUB_OUTPUT
4586
echo "Generated tag: $TAG"
46-
87+
4788
- name: Create zip archives
4889
run: |
4990
zip -r plugins.zip plugins/
5091
zip -r readmes.zip readmes/
5192
zip -r plugins-and-readmes.zip plugins/ readmes/
52-
93+
5394
- name: Create Release
5495
uses: softprops/action-gh-release@v2
5596
with:
5697
tag_name: ${{ steps.tag.outputs.tag }}
5798
name: Release ${{ steps.tag.outputs.tag }}
5899
body: |
59100
Automatic release created from PR merge
60-
101+
61102
**PR**: #${{ github.event.pull_request.number }} - ${{ github.event.pull_request.title }}
62103
**Merged by**: @${{ github.event.pull_request.merged_by.login }}
63104
**Commit**: ${{ github.sha }}

.github/workflows/update-plugin-data.yml

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)