1
- # https://help.github.com/en/categories/automating-your-workflow-with-github-actions
2
-
3
1
name : " Compile PHAR"
4
2
5
3
on :
@@ -14,90 +12,126 @@ jobs:
14
12
compile :
15
13
name : " Compile PHAR"
16
14
runs-on : " ubuntu-latest"
17
-
18
15
strategy :
19
- fail-fast : false
16
+ fail-fast : true
20
17
matrix :
21
18
include :
22
- - php-version : ' 8.0'
19
+ - php-version : ' 8.0'
20
+ - php-version : ' 8.1'
21
+ - php-version : ' 8.2'
23
22
24
23
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
0 commit comments