-
-
Notifications
You must be signed in to change notification settings - Fork 16
152 lines (124 loc) · 4.88 KB
/
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: 'Releasing latest changes'
on:
push:
tags:
- '*'
env:
# 1. for Github split
GITHUB_TOKEN: ${{ secrets.ECOTONE_BOT_TOKEN }}
jobs:
prepare-code-for-release:
name: "Auto fix PHP CS and set up required package versions"
runs-on: ubuntu-latest
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
coverage: none
- name: We need to fetch all related branches to perform next action
uses: actions/checkout@v4
with:
fetch-depth: '0'
token: ${{ secrets.ECOTONE_BOT_TOKEN }}
- name: Ensure ECOTONE_ENTERPRISE_PUBLIC_KEY secret exists
run: |
if [ -z "${{ secrets.ECOTONE_ENTERPRISE_PUBLIC_KEY }}" ]; then
echo "ECOTONE_ENTERPRISE_PUBLIC_KEY secret is missing"
exit 1
fi
- name: Setup Git
run: |
git config user.name "Ecotone Framework Bot"
git config user.email "ecotoneframework@gmail.com"
- name: Checkout branch related to tag
run: |
raw=$(git branch -r --contains ${{ github.ref }})
branch=${raw##*/}
echo "checking out branch $branch for tag ${GITHUB_REF#refs/tags/}"
git checkout $branch
- name: Install PHP-CS-Fixer
run: |
composer global require friendsofphp/php-cs-fixer
export PATH="$PATH:$HOME/.composer/vendor/bin"
- name: Run PHP CS Fixer
run: php-cs-fixer fix --config=.php-cs-fixer.dist.php --allow-risky=yes
- name: Run Update Required Packages
run: php bin/update-required-packages.php ${{ github.ref_name }}
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Release ${{ github.ref_name }}
get_packages:
name: Package splitting
needs: prepare-code-for-release
runs-on: ubuntu-latest
steps:
- name: Set Up PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
coverage: none
- uses: actions/checkout@v2
- name: Get Packages
id: get_json
run: echo "::set-output name=json::$(bin/get-packages)"
- name: Output Packages
run: echo "${{ steps.get_json.outputs.json }}"
outputs:
matrix: ${{ steps.get_json.outputs.json }}
split_packages:
name: Split Package ${{ matrix.package.name }}
needs: get_packages
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
package: ${{ fromJson(needs.get_packages.outputs.matrix) }}
steps:
# We need to check out what we've committed in prepare-code-for-release
- name: We need to fetch all related branches to perform next action
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Checkout branch related to tag
run: |
raw=$(git branch -r --contains ${{ github.ref }})
branch=${raw##*/}
echo "checking out branch $branch for tag ${GITHUB_REF#refs/tags/}"
git checkout $branch
- name: Replace key.pem with ECOTONE_ENTERPRISE_PUBLIC_KEY
if: ${{ matrix.package.name == 'ecotone' }}
run: |
echo "${{ secrets.ECOTONE_ENTERPRISE_PUBLIC_KEY }}" > ${{ matrix.package.directory }}/src/Messaging/Config/Licence/key.pem
-
uses: "danharrin/monorepo-split-github-action@v2.3.0"
if: "startsWith(github.ref, 'refs/tags/')"
with:
tag: ${GITHUB_REF#refs/tags/}
# ↓ split "packages/easy-coding-standard" directory
package_directory: '${{ matrix.package.directory }}'
# ↓ into https://github.com/symplify/easy-coding-standard repository
repository_organization: '${{ matrix.package.organisation }}'
repository_name: '${{ matrix.package.repository }}'
commit_message: 'Release version ${{ github.ref_name }}'
# ↓ the user signed under the split commit
user_name: "Ecotone FrameworkBot"
user_email: "ecotoneframework@gmail.com"
tweet:
runs-on: ubuntu-latest
needs: split_packages
steps:
- uses: Eomm/why-don-t-you-tweet@v1
with:
tweet-message: New Ecotone version was released ${{ github.ref_name }}. Check the changelog on https://github.com/ecotoneframework/ecotone-dev/releases/tag/${{ github.ref_name }}
env:
# Get your tokens from https://developer.twitter.com/apps
TWITTER_CONSUMER_API_KEY: ${{ secrets.TWITTER_CONSUMER_API_KEY }}
TWITTER_CONSUMER_API_SECRET: ${{ secrets.TWITTER_CONSUMER_API_SECRET }}
TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }}
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}