aonach / ghactions-deploy
Deploy to servers via Github Actions + Deployer
Requires
- deployer/deployer: ^6.5
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-php8
- v1.3.0
- v1.2.0
- v1.1.12
- v1.1.11
- v1.1.10
- v1.1.9
- v1.1.8
- v1.1.7
- v1.1.6
- v1.1.5
- v1.1.4
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.1
- v1.0.0
- dev-37178618-readme-discovery-query
- dev-37178618-batch-ssh-commands
- dev-37178618-no-duplicate-shared
- dev-37178618-static-content-themes
- dev-37178618-config-order-check
- dev-37178618-background-cleanup
- dev-36979715-opcache-status-race
- dev-37056006-deploy-timeout-defaults
- dev-36979715-opcache-hypernode-fallback
- dev-composer-version
- dev-skip-git-lfs
- dev-sub-task-time
- dev-task-timing-tracking
- dev-comment-out-hypernode
- dev-restoring-opcache
- dev-fail-patches
This package is auto-updated.
Last update: 2026-10-21 17:13:31 UTC
README
The repository contains Deployer configuration for Magento2 and example of Github Actions workflow. The workflow creates events on push into dev/test/master branches and initiate a deployment process to dev/test/master servers, correspondingly.
You need to follow this simple steps to integrate in your project:
-
Copy deploy.yml from the repo to .github/workflow folder
-
Copy hosts.yml to root folder and fill the file with your data
-
Copy deploy.php to root folder if you want to override some tasks
-
Create required DEPLOY_KEY secret in the settings on your repository, it will be used for connect to servers
-
Prepare shared folder on your servers:
- copy app/etc/env.php from current document root to #deploy_path#/shared/app/etc/env.php
- copy all media files from pub/media to #deploy_path#/shared/pub/media
-
Be sure all deployment steps are going right on servers (take care about composer/ssh keys)
-
Push a commit to dev/test/master branch!
Configuration
Git LFS
By default, Git LFS files are skipped during deployment (skip_lfs: true). This prevents large LFS objects (e.g., local database backups) from being downloaded to servers, saving both deployment time and disk space.
To disable this, set skip_lfs: false in your hosts.yml:
production: hostname: prod-server remote_user: deploy skip_lfs: false
Note: The skip_lfs option uses set('env', ...) to configure the GIT_LFS_SKIP_SMUDGE environment variable. If your project needs additional environment variables, add them inside the same closure in deploy.php rather than calling set('env', ...) separately, which would overwrite the LFS setting.
Static content: build only what the site serves
Why. Out of the box, setup:static-content:deploy builds every theme Magento knows about (Magento/blank, Magento/luma, Hyva/default, Hyva/reset, ...) in every locale, one after another, and a site only ever serves a few of them. On sportresponse (Sept 2026) that step took 311s; 14 theme/locale combinations were built and 3 were needed. Building only those took 84s on the test server. It's the biggest single saving available per deploy.
How. The recipe uses the static content settings from Deployer's own Magento recipe (recipe/magento2.php): static_content_locales, magento_themes, static_deploy_options, split_static_deployment, static_content_locales_backend, magento_themes_backend, static_content_jobs. See the comments in deploy.php. static_content_locales defaults to our older asset_locales. With nothing set, everything is built exactly as before, so each site opts in when it is ready.
The one trap: locales. A page's CSS/JS only exists for the locales that are built:
- the storefront uses its store view's locale;
- a logged-in admin user uses their own Interface Locale;
- the admin login page uses the store's default locale (
general/locale/code), because nobody is logged in yet.
Miss one and that page loads with no CSS/JS. Nothing errors and the deploy succeeds (sportresponse test lost its admin login page this way). The simple answer is one locale per site: the store's default locale, with every admin user set to it. In practice all our sites are English and the different locales are leftover defaults (en_US is Magento's default; en_IE/en_GB is where we are). A genuinely multi-language site lists its real locales instead.
Enabling it on a site (sportresponse as the worked example)
-
Find out what the site serves. Run read-only queries on the site's database (test first, then production), with the table prefix from
app/etc/env.phpif there is one:SELECT theme_id, area, theme_path FROM theme; SELECT scope, scope_id, path, value FROM core_config_data WHERE path IN ('design/theme/theme_id', 'general/locale/code', 'hyva_theme_fallback/general/theme_full_path') OR path LIKE 'admin/system_admin_design/%'; -- a non-default admin theme, if any SELECT interface_locale, is_active, COUNT(*) FROM admin_user GROUP BY 1, 2;
sportresponse: one store view on theme 7 (
Aonach/hyva), default localeen_IE, Hyvä checkout fallbackfrontend/Aonach/checkout, all 8 admin users onen_US. -
Pick the site's locale: the store's default locale (
en_IEfor sportresponse). Keep the store's locale rather than switching the store toen_US: it sets date and number formats for customers. The English wording is the same either way. -
Switch the admin users to that locale. Do this before step 4, while the admin is still built in both locales, so nobody is ever left on a locale that isn't built:
UPDATE admin_user SET interface_locale = 'en_IE' WHERE interface_locale <> 'en_IE';
In production mode Magento only offers built locales when creating an admin user, so new users can then only pick that locale.
-
Set the site's config in hosts.yml for that host:
static_content_locales: en_IE # the store's default locale magento_themes: [Aonach/hyva, Aonach/checkout, Magento/backend] # store view theme(s), Hyvä checkout fallback, admin theme static_deploy_options: --no-parent
List every theme assigned to a store view, the Hyvä checkout fallback theme, and the admin theme (
Magento/backend, unless the site uses another admin theme).--no-parentstops parent themes being built as themes of their own. They are still used as fallback sources. -
Deploy to test (PR into
test) and check:pub/staticcontains only the listed themes and locale;- the storefront, a checkout page (the fallback theme), the admin login page and a logged-in admin page all load their CSS/JS;
- the deploy log shows a single
setup:static-content:deploywith the themes and locale above.
-
Production: repeat steps 1-3 on the production database, add the same settings to the production host, and ship it with the usual
test→mainPR.
Related links:
https://help.github.com/en/github/automating-your-workflow-with-github-actions