-
Notifications
You must be signed in to change notification settings - Fork 3
81 lines (67 loc) · 2.27 KB
/
website.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
name: Generate data files
on:
schedule:
- cron: '40 6,12,18 * * *'
push:
branches:
- master
jobs:
build:
name: Generate
runs-on: ubuntu-latest
steps:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
- name: Checkout code
uses: actions/checkout@v4
with:
path: 'source'
- name: Checkout Symfony repo
run: git clone https://github.com/symfony/symfony symfony
- name: Download dependencies
run: |
cd source
composer install --no-interaction --optimize-autoloader
- name: Generate data files
run: |
WORKDIR=$(pwd)
for version in $(cd $WORKDIR/source && php bin/console app:supported-versions); do
cd $WORKDIR/symfony && git checkout $version
cd $WORKDIR/source && php bin/console app:trans-stats $WORKDIR/symfony > config/data/$version.json
done
- name: Commit & push the new files
id: commit_push
run: |
echo "::group::git status"
cd source
git status
echo "::endgroup::"
git add -N .
if [[ $(git diff --numstat | wc -l) -eq 0 ]]; then
echo "No changes found. Exiting."
echo "::set-output name=publish::false"
exit 0;
fi
git config --local user.email "[email protected]"
git config --local user.name "GitHub Bot"
echo "::group::git push"
git add .
git commit -m "Update data files"
git push
echo "::endgroup::"
echo "::set-output name=publish::true"
- name: Build website
env:
CUSTOM_GITHUB_TOKEN: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
run: |
cd source
bin/console app:build-website
- name: Deploy website
if: ${{ github.event_name == 'push' || steps.commit_push.outputs.publish == 'true' }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: "eu-central-1"
run: aws s3 sync ./source/build s3://symfony-translations.nyholm.tech --cache-control max-age=7200