This repository has been archived by the owner on Mar 1, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
135 lines (109 loc) · 5.13 KB
/
semantic-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
name: "Semantic Release"
on: # yamllint disable-line rule:truthy
push:
branches:
- "([0-9])?(.{+([0-9]),x}).x"
- "main"
- "next"
- "next-major"
- "alpha"
- "beta"
jobs:
test:
name: "Config Check"
runs-on: "ubuntu-latest"
strategy:
matrix:
php-versions: ["8.0"]
dependencies: ["locked"]
env:
key: "semantic-release-linux-v1" # change key (version) to clear cache
extensions: "mbstring"
ini-values: "date.timezone=Europe/Berlin, assert.exception=1, zend.assertions=1, opcache.enable=1, opcache.enable_cli=0, opcache.optimization_level=-1, opcache.jit=1255, opcache.jit_buffer_size=32M, serialize_precision=14"
tools: "composer, cs2pr"
steps:
- name: "Git checkout"
uses: "actions/checkout@v2"
with:
fetch-depth: 2
env:
GIT_COMMITTER_NAME: "GitHub Actions Shell"
GIT_AUTHOR_NAME: "GitHub Actions Shell"
EMAIL: "github-actions[bot]@users.noreply.github.com"
- name: "Setup cache environment"
id: "cache-env"
uses: "shivammathur/cache-extensions@v1"
with:
php-version: "${{ matrix.php-versions }}"
extensions: "${{ env.extensions }}"
key: "${{ env.key }}"
- name: "Cache extensions"
uses: "actions/cache@v2"
with:
path: "${{ steps.cache-env.outputs.dir }}"
key: "${{ steps.cache-env.outputs.key }}"
restore-keys: "${{ steps.cache-env.outputs.key }}"
- name: "Setup PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-versions }}"
extensions: "${{ env.extensions }}"
ini-values: "${{ env.ini-values }}"
tools: "${{ env.tools }}"
coverage: "pcov"
- name: "Setup Problem Matchers for PHP"
run: "echo '::add-matcher::${{ runner.tool_cache }}/php.json'"
- name: "Check PHP Version"
run: "php -v"
- name: "List all php extensions with versions"
run: "php -r 'foreach (get_loaded_extensions() as $extension) echo $extension . \" \" . phpversion($extension) . PHP_EOL;'"
- name: "Configure Container"
env:
GIT_USER_EMAIL: "${{ secrets.GIT_USER_EMAIL }}"
GIT_USER_USERNAME: "${{ secrets.GIT_USER_USERNAME }}"
run: |
EMAIL=${GIT_USER_EMAIL:-"github-actions[bot]@users.noreply.github.com"}
NAME=${GIT_USER_USERNAME:-"github-actions-shell"}
git config --global user.email "${EMAIL}"
git config --global user.name "${NAME}"
- name: "Check Composer Version"
run: "composer -V"
- name: "Validate composer.json and composer.json"
run: "composer validate --strict"
- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"
with:
dependency-versions: "${{ matrix.dependencies }}"
- name: "validate .php_cs file"
run: |
mkdir -p ./.build/php-cs-fixer
./vendor/bin/php-cs-fixer fix --config='./.php_cs' --ansi --dry-run
- name: "validate base_rules.neon file"
run: "./vendor/bin/phpstan analyse -c ./base_rules.neon ./"
semantic-release:
name: "Semantic Release"
if: "github.repository != 'narrowspark/php-library-template'"
runs-on: "ubuntu-latest"
needs: ["test"]
steps:
- uses: "actions/checkout@v2"
with:
persist-credentials: false
- name: "Semantic Release"
uses: "cycjimmy/semantic-release-action@v2"
with:
semantic_version: "17.0.7"
extra_plugins: |
@semantic-release/changelog@^5.0.1
@semantic-release/git@^9.0.0
@google/semantic-release-replace-plugin@^1.0.0
conventional-changelog-conventionalcommits@^4.3.0
env:
# We can't rely on the GITHUB_TOKEN as we need to trigger
# further actions and the GITHUB_TOKEN doesn't allow it
GITHUB_TOKEN: "${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }}"
GIT_AUTHOR_NAME: "github-actions-shell"
GIT_AUTHOR_EMAIL: "github-actions[bot]@users.noreply.github.com"
GIT_COMMITTER_NAME: "github-actions-shell"
GIT_COMMITTER_EMAIL: "github-actions[bot]@users.noreply.github.com"