|
3 | 3 | repository_dispatch: |
4 | 4 | types: [config_change] |
5 | 5 | name: Update config |
6 | | -env: |
7 | | - GH_TOKEN: ${{ github.token }} |
8 | 6 | jobs: |
9 | 7 | update-config: |
10 | | - runs-on: ubuntu-latest |
11 | | - container: |
12 | | - image: ghcr.io/city-of-helsinki/drupal-web:8.3 |
13 | | - options: --hostname app --user 1001 |
14 | | - services: |
15 | | - db: |
16 | | - image: mysql:8 |
17 | | - env: |
18 | | - MYSQL_USER: drupal |
19 | | - MYSQL_PASSWORD: drupal |
20 | | - MYSQL_DATABASE: drupal |
21 | | - MYSQL_ROOT_PASSWORD: drupal |
22 | | - ports: |
23 | | - - 3306:3306 |
24 | | - |
25 | | - steps: |
26 | | - - uses: actions/checkout@v4 |
27 | | - |
28 | | - - name: Check if required secrets are set |
29 | | - env: |
30 | | - AUTOMATIC_UPDATE_TOKEN: ${{ secrets.AUTOMATIC_UPDATE_TOKEN }} |
31 | | - if: env.AUTOMATIC_UPDATE_TOKEN == '' |
32 | | - run: exit 1 |
33 | | - |
34 | | - - name: Download latest dump |
35 | | - env: |
36 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
37 | | - run: | |
38 | | - gh run download -n latest.sql |
39 | | -
|
40 | | - - name: Prepare setup |
41 | | - run: | |
42 | | - # We install Drupal from existing dump, so locale_install() hook |
43 | | - # is never fired. Make sure the translations folder exists. |
44 | | - mkdir -p public/sites/default/files/translations -p |
45 | | -
|
46 | | - - name: Build project |
47 | | - run: | |
48 | | - composer install --no-interaction |
49 | | - $(drush sql:connect) < latest.sql |
50 | | - drush cim -y && drush updb -y && drush cr |
51 | | - composer update drupal/helfi_* drupal/hdbt* -W --no-interaction |
52 | | - drush cr |
53 | | -
|
54 | | - # Update translations from localize.drupal.org and helfi-modules |
55 | | - # before running update hooks to reduce clutter in configuration files. |
56 | | - drush locale:check && drush locale:update |
57 | | - drush updb -y |
58 | | -
|
59 | | - # Update translations from helfi_platform_config. These translations |
60 | | - # consists of overrides for non customised translations and will |
61 | | - # override current translation with a non customised translation. |
62 | | - drush helfi:locale-import helfi_platform_config |
63 | | - drush cex -y |
64 | | -
|
65 | | - # Update platform |
66 | | - drush helfi:tools:update-platform |
67 | | -
|
68 | | - - name: Check module versions |
69 | | - id: module-status |
70 | | - run: | |
71 | | - MODE="delete" |
72 | | - drush helfi:tools:check-composer-versions $GITHUB_WORKSPACE/composer.lock --format=markdown_table >> $GITHUB_STEP_SUMMARY && EXIT_CODE=$? || EXIT_CODE=$? |
73 | | - if [ "$EXIT_CODE" -eq 3 ]; then |
74 | | - MODE="upsert" |
75 | | - echo " " >> $GITHUB_STEP_SUMMARY |
76 | | - echo ":warning: Failed to install the latest version of the packages listed above" >> $GITHUB_STEP_SUMMARY |
77 | | - echo " " >> $GITHUB_STEP_SUMMARY |
78 | | - echo "Please run \`composer why-not drupal/package_name package_version\` to see why." >> $GITHUB_STEP_SUMMARY |
79 | | - fi |
80 | | - echo "MODE=$MODE" >> $GITHUB_OUTPUT |
81 | | - cat $GITHUB_STEP_SUMMARY > /tmp/pr-message.txt |
82 | | -
|
83 | | - - name: Create Pull Request |
84 | | - uses: peter-evans/create-pull-request@v6 |
85 | | - with: |
86 | | - commit-message: Update configuration |
87 | | - token: ${{ secrets.AUTOMATIC_UPDATE_TOKEN }} |
88 | | - title: Automatic update |
89 | | - labels: auto-update |
90 | | - body: | |
91 | | - - Updated active configuration. |
92 | | - - Updated platform |
93 | | - branch: update-configuration |
94 | | - |
95 | | - - name: Attempt to find PR |
96 | | - env: |
97 | | - BRANCH_NAME: ${{ github.head_ref || github.ref_name }} |
98 | | - id: find-pr |
99 | | - run: echo "number=$(gh pr list --base ${BRANCH_NAME} --head update-configuration --json number --jq '.[].number')" >> $GITHUB_OUTPUT |
100 | | - |
101 | | - - name: Comment PR |
102 | | - uses: thollander/actions-comment-pull-request@v2 |
103 | | - if: ${{ steps.find-pr.outputs.number != '' }} |
104 | | - with: |
105 | | - comment_tag: status |
106 | | - mode: ${{ steps.module-status.outputs.MODE }} |
107 | | - filePath: /tmp/pr-message.txt |
108 | | - pr_number: ${{ steps.find-pr.outputs.number }} |
| 8 | + uses: city-of-helsinki/drupal-gh-actions/.github/workflows/update-config.yml@main |
| 9 | + secrets: |
| 10 | + automatic_update_token: ${{ secrets.AUTOMATIC_UPDATE_TOKEN }} |
0 commit comments