-
Notifications
You must be signed in to change notification settings - Fork 33
78 lines (75 loc) · 2.42 KB
/
build.yaml
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
name: Build
on:
workflow_dispatch:
push:
branches:
- master
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-*'
jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
tools: composer
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-php${{ matrix.php-versions }}
- name: Install dependencies
run: composer install --prefer-dist --no-dev --optimize-autoloader --no-interaction
- name: Optimize vendor
run: php build/optimize_vendor.php
- name: Create archive
run: |
git archive --format=zip HEAD > Ilch-2.zip
zip -q -r Ilch-2.zip vendor
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: ilch2-zip
path: |
Ilch-2.zip
- name: Upload archive to ilch.de
if: ${{ github.ref_name == 'master' }}
uses: wlixcc/[email protected]
with:
username: 'ilch2'
server: 'ilch.de'
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
local_path: './Ilch-2.zip'
sftp_only: true
remote_path: '/versions/master.zip'
sftpArgs: '-o ConnectTimeout=5'
create-draft:
runs-on: ubuntu-20.04
needs: [build]
if: ${{ github.ref_type == 'tag' }}
steps:
- name: Download a single artifact
uses: actions/download-artifact@v3
with:
name: ilch2-zip
- name: Prepare release
id: prepare-release
run: |
mv Ilch-2.zip Ilch-${{ github.ref_name }}.zip
echo "VERSION=${GITHUB_REF_NAME/v/}" >> $GITHUB_OUTPUT
- name: Create release draft
uses: ncipollo/release-action@v1
with:
artifacts: ${{ format('Ilch-{0}.zip', github.ref_name) }}
token: ${{ secrets.GITHUB_TOKEN }}
draft: true
name: ${{ format('Version {0}', steps.prepare-release.outputs.VERSION) }}