-
Notifications
You must be signed in to change notification settings - Fork 640
87 lines (73 loc) · 3.36 KB
/
create-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
name: Create Release
run-name: Create release for ${{ github.event.client_payload.version }}
on:
repository_dispatch:
types:
- craftcms/new-release
env:
PROJECT_DIRECTORY: 'craftcms'
BUNDLE_ZIP_FILENAME: 'CraftCMS-${{ github.event.client_payload.version }}.zip'
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: 'Set up PHP for Craft 3'
uses: shivammathur/[email protected]
if: ${{ startsWith(github.event.client_payload.version, '3.') }}
with:
extensions: bcmath, curl, dom, json, intl, mbstring, mcrypt, openssl, pcre, pdo, zip
php-version: 7.2.5
tools: composer:v2
- name: 'Set up PHP for Craft 4'
uses: shivammathur/[email protected]
if: ${{ startsWith(github.event.client_payload.version, '4.') }}
with:
extensions: bcmath, curl, dom, json, intl, mbstring, mcrypt, openssl, pcre, pdo, zip
php-version: 8.2.0
tools: composer:v2
- name: 'Set up PHP for Craft 5'
uses: shivammathur/[email protected]
if: ${{ startsWith(github.event.client_payload.version, '5.') }}
with:
extensions: bcmath, curl, dom, json, intl, mbstring, mcrypt, openssl, pcre, pdo, zip
php-version: 8.2.0
tools: composer:v2
- name: 'Initialize Craft 3 starter project'
if: ${{ startsWith(github.event.client_payload.version, '3.') }}
run: 'composer create-project craftcms/craft:^3 ${{ env.PROJECT_DIRECTORY }}'
- name: 'Initialize Craft 4 starter project'
if: ${{ startsWith(github.event.client_payload.version, '4.') }}
run: 'composer create-project craftcms/craft:^4 --no-scripts ${{ env.PROJECT_DIRECTORY }}'
- name: 'Initialize Craft 5 starter project'
if: ${{ startsWith(github.event.client_payload.version, '5.') }}
run: 'composer create-project craftcms/craft:^5 --no-scripts ${{ env.PROJECT_DIRECTORY }}'
- name: 'Replace composer.json with composer.json.default'
working-directory: ${{ env.PROJECT_DIRECTORY }}
run: 'test -f composer.json.default && rm composer.json && mv composer.json.default composer.json'
continue-on-error: true
- name: 'Install specific Craft version'
working-directory: ${{ env.PROJECT_DIRECTORY }}
run: 'composer require craftcms/cms:${{ github.event.client_payload.version }} --update-with-dependencies'
- name: 'Update Craft 3 .env'
if: ${{ startsWith(github.event.client_payload.version, '3.') }}
working-directory: ${{ env.PROJECT_DIRECTORY }}
run: |
sed -i 's/SECURITY_KEY=.*/SECURITY_KEY=/g' .env
sed -i 's/APP_ID=.*/APP_ID=/g' .env
- name: 'Create zip'
working-directory: ${{ env.PROJECT_DIRECTORY }}
run: 'zip -r ../${{ env.BUNDLE_ZIP_FILENAME }} ./'
- name: 'Create release'
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: ${{ env.BUNDLE_ZIP_FILENAME }}
body: ${{ github.event.client_payload.notes }}
makeLatest: ${{ github.event.client_payload.latest }}
name: ${{ github.event.client_payload.version }}
prerelease: ${{ github.event.client_payload.prerelease }}
tag: ${{ github.event.client_payload.tag }}