Skip to content

Commit 4edbbd4

Browse files
Added automatic call to the application compiler after the Release Drafter runs
1 parent f6ea768 commit 4edbbd4

File tree

2 files changed

+42
-23
lines changed

2 files changed

+42
-23
lines changed

.github/workflows/build.yml

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,26 @@ on:
66
tag:
77
description: 'Tag version'
88
required: true
9+
workflow_call:
10+
inputs:
11+
tag:
12+
type: string
13+
required: true
914

1015
permissions: write-all
1116

17+
env:
18+
TAG_NAME: ${{ inputs.tag || github.event.inputs.tag }}
19+
1220
jobs:
1321
build:
1422
runs-on: ubuntu-latest
15-
23+
24+
name: Build
25+
1626
steps:
17-
- name: Extract the tag version
18-
id: tag
19-
run: |
20-
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
21-
GITHUB_REF=${{ github.event.inputs.tag }}
22-
fi
23-
echo "tag=${GITHUB_REF##*v}" >> "$GITHUB_OUTPUT"
27+
- name: Detect version
28+
run: echo "New versions is $TAG_NAME"
2429

2530
- name: Checkout the code
2631
uses: actions/checkout@v4
@@ -39,7 +44,7 @@ jobs:
3944
run: composer test
4045

4146
- name: Create the PHAR file
42-
run: php ./notifications app:build notifications --build-version=${{ steps.tag.outputs.tag }} --ansi
47+
run: php ./notifications app:build notifications --build-version=$TAG_NAME --ansi
4348

4449
- name: Show version
4550
run: php builds/notifications --version
@@ -49,17 +54,27 @@ jobs:
4954
with:
5055
name: notifications
5156
path: builds/notifications
52-
retention-days: 30
57+
retention-days: 14
5358

54-
push:
59+
pull_request:
5560
runs-on: ubuntu-latest
56-
61+
5762
needs: build
5863

64+
name: Create a Pull Request
65+
5966
steps:
6067
- name: Checkout the code
6168
uses: actions/checkout@v4
6269

70+
- name: Make a title
71+
id: title
72+
run: |
73+
echo "title=🏗️ Build the application version ${TAG_NAME}" >> "$GITHUB_OUTPUT"
74+
75+
- name: Show title
76+
run: echo ${{ steps.title.outputs.title }}
77+
6378
- name: Remove old file
6479
run: rm -f builds/notifications
6580

@@ -68,20 +83,14 @@ jobs:
6883
name: notifications
6984
path: builds
7085

71-
- name: Push changes
72-
uses: ad-m/github-push-action@master
73-
if: steps.build.outputs.is_dirty == 1
74-
with:
75-
github_token: ${{ secrets.COMPOSER_TOKEN }}
76-
7786
- name: Create a Pull Request
7887
uses: peter-evans/create-pull-request@v6
7988
with:
80-
branch: app
89+
branch: build/app
8190
branch-suffix: random
8291
delete-branch: true
8392
add-paths: ./builds/notifications
84-
title: "🏗️ Build application"
85-
commit-message: 🏗️ Build application
93+
title: ${{ steps.title.outputs.title }}
94+
commit-message: ${{ steps.title.outputs.title }}
8695
body: Application compiled successfully
8796
labels: build

.github/workflows/release-drafter.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,18 @@ on:
44
push:
55
branches:
66
- main
7+
- 1.x
78
workflow_dispatch:
89

910
jobs:
10-
Update:
11-
uses: TheDragonCode/.github/.github/workflows/release-drafter.yml@main
11+
draft:
12+
name: Drafter
13+
uses: TheDragonCode/.github/.github/workflows/release-drafter.yml@main
14+
15+
build:
16+
needs: draft
17+
18+
name: App
19+
uses: TheDragonCode/github-notifications/.github/workflows/[email protected]
20+
with:
21+
tag: ${{ needs.draft.outputs.tag_name }}

0 commit comments

Comments
 (0)