Skip to content

Commit 0a709cb

Browse files
update php version in workflows (#131)
1 parent fb698cc commit 0a709cb

File tree

4 files changed

+124
-87
lines changed

4 files changed

+124
-87
lines changed

.github/workflows/phar-development.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ jobs:
1818
fail-fast: false
1919
matrix:
2020
include:
21-
- php-version: '7.4'
2221
- php-version: '8.0'
22+
- php-version: '8.1'
23+
- php-version: '8.2'
2324

2425
steps:
2526
- name: "Checkout"

.github/workflows/phar.yml

+118-84
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
2-
31
name: "Compile PHAR"
42

53
on:
@@ -14,90 +12,126 @@ jobs:
1412
compile:
1513
name: "Compile PHAR"
1614
runs-on: "ubuntu-latest"
17-
1815
strategy:
19-
fail-fast: false
16+
fail-fast: true
2017
matrix:
2118
include:
22-
- php-version: '8.0'
19+
- php-version: '8.0'
20+
- php-version: '8.1'
21+
- php-version: '8.2'
2322

2423
steps:
25-
- name: "Checkout"
26-
uses: "actions/checkout@v2"
27-
with:
28-
fetch-depth: 0
29-
30-
- name: "Install PHP"
31-
uses: "shivammathur/setup-php@v2"
32-
with:
33-
coverage: "none"
34-
php-version: ${{ matrix.php-version }}
35-
tools: composer:v1
36-
env:
37-
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38-
39-
- name: "Cache dependencies"
40-
uses: "actions/cache@v2"
41-
with:
42-
path: "~/.composer/cache"
43-
key: "php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}"
44-
restore-keys: "php-${{ matrix.php-version }}-composer-"
45-
46-
- name: "Install dependencies"
47-
run: "composer install --no-interaction --no-progress --no-suggest --no-dev"
48-
49-
- name: "Download box"
50-
run: wget -O box.phar https://github.com/box-project/box/releases/download/${BOX_VERSION}/box.phar
51-
env:
52-
BOX_VERSION: 3.11.0
53-
54-
- name: "Prepare pem File"
55-
env:
56-
PHAR_PRIVATE: ${{ secrets.PHAR_PRIVATE }}
57-
run: echo "$PHAR_PRIVATE" > .github/phar-private.pem
58-
59-
- name: "Compile PHAR"
60-
run: php box.phar compile
61-
62-
- name: "Run phar to see if it works"
63-
run: php nanbando.phar
64-
65-
- name: "Checkout gh-pages"
66-
uses: "actions/checkout@v2"
67-
with:
68-
ref: gh-pages
69-
path: gh-pages
70-
token: ${{ secrets.PAT }}
71-
72-
- name: "cp PHAR"
73-
run: |
74-
cp nanbando.phar gh-pages/nanbando.phar
75-
76-
- name: "Create sha1sum"
77-
working-directory: gh-pages
78-
run: |
79-
sha1sum nanbando.phar > nanbando.phar.version
80-
81-
- name: "Configure Git"
82-
working-directory: gh-pages
83-
run: |
84-
git config user.email "johannes@sulu.io" && \
85-
git config user.name "Johannes Wachter"
86-
87-
- name: "Commit PHAR - master"
88-
working-directory: gh-pages
89-
if: "!startsWith(github.ref, 'refs/tags/')"
90-
run: |
91-
git add nanbando.phar nanbando.phar.version && \
92-
git commit -m "Updated nanbando to commit ${{ github.event.after }}" && \
93-
git push
94-
95-
- name: "Create Release - tag"
96-
uses: softprops/action-gh-release@v1
97-
if: startsWith(github.ref, 'refs/tags/')
98-
env:
99-
GITHUB_TOKEN: ${{ secrets.PAT }}
100-
with:
101-
files: |
102-
nanbando.phar
103-
nanbando.phar.pubkey
24+
- name: "Checkout"
25+
uses: "actions/checkout@v2"
26+
with:
27+
fetch-depth: 0
28+
29+
- name: "Install PHP"
30+
uses: "shivammathur/setup-php@v2"
31+
with:
32+
coverage: "none"
33+
php-version: ${{ matrix.php-version }}
34+
tools: composer:v1
35+
env:
36+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- name: "Cache dependencies"
39+
uses: "actions/cache@v2"
40+
with:
41+
path: "~/.composer/cache"
42+
key: "php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}"
43+
restore-keys: "php-${{ matrix.php-version }}-composer-"
44+
45+
- name: "Install dependencies"
46+
run: "composer install --no-interaction --no-progress --no-suggest --no-dev"
47+
48+
- name: "Download box"
49+
run: wget -O box.phar https://github.com/box-project/box/releases/download/${BOX_VERSION}/box.phar
50+
env:
51+
BOX_VERSION: 3.11.0
52+
53+
- name: "Prepare pem File"
54+
env:
55+
PHAR_PRIVATE: ${{ secrets.PHAR_PRIVATE }}
56+
run: echo "$PHAR_PRIVATE" > .github/phar-private.pem
57+
58+
- name: "Compile PHAR"
59+
run: php box.phar compile
60+
61+
- name: "Run phar to see if it works"
62+
run: php nanbando.phar
63+
64+
- name: "Rename PHAR with version suffix"
65+
run: |
66+
mv nanbando.phar nanbando-php${{ matrix.php-version }}.phar
67+
cp nanbando-php${{ matrix.php-version }}.phar nanbando-php${{ matrix.php-version }}.phar.pubkey
68+
69+
- name: "Upload PHAR as artifact"
70+
uses: actions/upload-artifact@v2
71+
with:
72+
name: nanbando-php${{ matrix.php-version }}
73+
path: |
74+
nanbando-php${{ matrix.php-version }}.phar
75+
nanbando-php${{ matrix.php-version }}.phar.pubkey
76+
77+
deploy:
78+
name: "Deploy PHARs"
79+
needs: compile
80+
runs-on: "ubuntu-latest"
81+
steps:
82+
- name: "Checkout gh-pages"
83+
uses: "actions/checkout@v2"
84+
with:
85+
ref: gh-pages
86+
path: gh-pages
87+
token: ${{ secrets.PAT }}
88+
89+
- name: "Download all artifacts"
90+
uses: actions/download-artifact@v2
91+
with:
92+
path: artifacts
93+
94+
- name: "Copy PHARs to gh-pages"
95+
run: |
96+
cp artifacts/nanbando-php8.0/nanbando-php8.0.phar* gh-pages/
97+
cp artifacts/nanbando-php8.1/nanbando-php8.1.phar* gh-pages/
98+
cp artifacts/nanbando-php8.2/nanbando-php8.2.phar* gh-pages/
99+
cp artifacts/nanbando-php8.2/nanbando-php8.2.phar gh-pages/nanbando.phar
100+
cp artifacts/nanbando-php8.2/nanbando-php8.2.phar.pubkey gh-pages/nanbando.phar.pubkey
101+
102+
- name: "Create sha1sum"
103+
working-directory: gh-pages
104+
run: |
105+
sha1sum nanbando-php8.0.phar > nanbando-php8.0.phar.version
106+
sha1sum nanbando-php8.1.phar > nanbando-php8.1.phar.version
107+
sha1sum nanbando-php8.2.phar > nanbando-php8.2.phar.version
108+
sha1sum nanbando.phar > nanbando.phar.version
109+
110+
- name: "Configure Git"
111+
working-directory: gh-pages
112+
run: |
113+
git config user.email "johannes@sulu.io"
114+
git config user.name "Johannes Wachter"
115+
116+
- name: "Commit PHARs"
117+
working-directory: gh-pages
118+
run: |
119+
git add nanbando-php8.0.phar* nanbando-php8.1.phar* nanbando-php8.2.phar* nanbando.phar*
120+
git commit -m "Updated nanbando PHARs for commit ${{ github.sha }}"
121+
git push
122+
123+
- name: "Create Release"
124+
if: startsWith(github.ref, 'refs/tags/')
125+
uses: softprops/action-gh-release@v1
126+
env:
127+
GITHUB_TOKEN: ${{ secrets.PAT }}
128+
with:
129+
files: |
130+
gh-pages/nanbando-php8.0.phar
131+
gh-pages/nanbando-php8.1.phar
132+
gh-pages/nanbando-php8.2.phar
133+
gh-pages/nanbando.phar
134+
gh-pages/nanbando-php8.0.phar.pubkey
135+
gh-pages/nanbando-php8.1.phar.pubkey
136+
gh-pages/nanbando-php8.2.phar.pubkey
137+
gh-pages/nanbando.phar.pubkey

.github/workflows/php.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
include:
19-
- php-version: '7.4'
2019
- php-version: '8.0'
20+
- php-version: '8.1'
21+
- php-version: '8.2'
2122

2223
steps:
2324
- name: Checkout project

composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
},
4444
"require-dev": {
4545
"phpunit/phpunit": "^7.0 || ^8.5",
46-
"league/flysystem-memory": "^1.0"
46+
"league/flysystem-memory": "^1.0",
47+
"phpspec/prophecy": "^1.19"
4748
},
4849
"autoload": {
4950
"psr-4": {

0 commit comments

Comments
 (0)