Skip to content

Commit f9cf4fe

Browse files
committed
New release workflow
1 parent 0cdf08e commit f9cf4fe

File tree

3 files changed

+84
-22
lines changed

3 files changed

+84
-22
lines changed

.github/workflows/release.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
2+
3+
name: "Create release"
4+
5+
on:
6+
push:
7+
tags:
8+
- '*'
9+
10+
concurrency: release
11+
12+
jobs:
13+
deploy:
14+
name: "Deploy"
15+
runs-on: "ubuntu-latest"
16+
17+
steps:
18+
- name: "Checkout"
19+
uses: "actions/checkout@v2"
20+
21+
- name: "Create release"
22+
uses: softprops/action-gh-release@v1
23+
with:
24+
token: ${{ secrets.PHPSTAN_BOT_TOKEN }}

.github/workflows/send-pr.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
2+
3+
name: "Send pull request"
4+
5+
on:
6+
release:
7+
types: [published]
8+
9+
jobs:
10+
send-pr:
11+
name: "Send pull request"
12+
runs-on: "ubuntu-latest"
13+
steps:
14+
- name: "Install PHP"
15+
uses: "shivammathur/setup-php@v2"
16+
with:
17+
coverage: "none"
18+
php-version: "8.0"
19+
20+
- name: "Checkout phpstan-src"
21+
uses: "actions/checkout@v2"
22+
with:
23+
repository: phpstan/phpstan-src
24+
path: phpstan-src
25+
token: ${{ secrets.PHPSTAN_BOT_TOKEN }}
26+
27+
- name: "Install dependencies"
28+
working-directory: ./phpstan-src
29+
run: "composer install --no-interaction --no-progress --no-suggest"
30+
31+
- name: "Change composer.json"
32+
working-directory: ./phpstan-src
33+
run: "composer require phpstan/php-8-stubs:${{ github.ref }}"
34+
35+
- name: "Create Pull Request"
36+
uses: peter-evans/create-pull-request@v3
37+
with:
38+
token: ${{ secrets.PHPSTAN_BOT_TOKEN }}
39+
path: ./phpstan-src
40+
branch-suffix: short-commit-hash
41+
delete-branch: true
42+
title: "Update PHP 8 stubs"
43+
body: "Update PHP 8 stubs to ${{ github.ref }}"
44+
committer: "phpstan-bot <ondrej+phpstanbot@mirtes.cz>"
45+
commit-message: "Update PHP 8 stubs"

.github/workflows/update.yml

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
with:
2121
ref: ${{ github.head_ref }}
2222
fetch-depth: '0'
23+
token: ${{ secrets.PHPSTAN_BOT_TOKEN }}
2324
- name: "Install PHP"
2425
uses: "shivammathur/setup-php@v2"
2526
with:
@@ -36,30 +37,22 @@ jobs:
3637
ref: "PHP-8.0"
3738
- name: "Extract stubs"
3839
run: "./extractor/extract.php"
40+
- name: 'Get previous tag'
41+
id: previous_tag
42+
uses: "WyriHaximus/github-action-get-previous-tag@v1"
43+
with:
44+
fallback: 0.1.0
45+
- name: 'Get next minor version'
46+
id: semvers
47+
uses: "WyriHaximus/github-action-next-semvers@v1"
48+
with:
49+
version: ${{ steps.previous_tag.outputs.tag }}
3950
- name: "Commit changes"
4051
uses: "stefanzweifel/git-auto-commit-action@v4"
4152
id: "commit"
4253
with:
4354
commit_message: "Update stubs"
44-
commit_user_name: phpstan
45-
commit_user_email: actions@github.com
46-
commit_author: PHPStan Bot <actions@github.com>
47-
- name: "Tag new version"
48-
if: steps.commit.outputs.changes_detected == 'true'
49-
id: "tag"
50-
uses: "anothrNick/github-tag-action@1.30.0"
51-
env:
52-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53-
WITH_V: false
54-
RELEASE_BRANCHES: main
55-
DEFAULT_BUMP: patch
56-
- name: "Release new version"
57-
if: steps.commit.outputs.changes_detected == 'true'
58-
uses: actions/create-release@v1
59-
env:
60-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61-
with:
62-
tag_name: ${{ steps.tag.outputs.new_tag }}
63-
release_name: ${{ steps.tag.outputs.new_tag }}
64-
commitish: main
65-
body: "Update stubs"
55+
commit_user_name: "phpstan-bot"
56+
commit_user_email: "ondrej+phpstanbot@mirtes.cz"
57+
commit_author: "phpstan-bot <ondrej+phpstanbot@mirtes.cz>"
58+
tagging_message: ${{ steps.semvers.outputs.patch }}

0 commit comments

Comments
 (0)