Skip to content

Commit c67f6d0

Browse files
committed
feat: update deployment workflows
1 parent 3733970 commit c67f6d0

File tree

2 files changed

+82
-48
lines changed

2 files changed

+82
-48
lines changed

.github/workflows/deploy-release.yml

Lines changed: 41 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,44 +7,65 @@ on: # yamllint disable-line rule:truthy
77

88
name: 🚀 Deploy to production
99

10+
env:
11+
APP_RUNNER: 'cd app &&'
12+
1013
concurrency: production
1114

1215
jobs:
1316
deployment:
17+
timeout-minutes: 8
1418
runs-on: ${{ matrix.os }}
1519
strategy:
16-
fail-fast: true
1720
matrix:
18-
os: ["ubuntu-22.04"]
19-
php: ["8.3"]
21+
os:
22+
- ubuntu-latest
23+
php-version:
24+
- '8.3'
25+
dependencies:
26+
- locked
2027
environment:
2128
name: production
2229
url: https://prod.laravel-starter-tpl.wayof.dev
2330

2431
steps:
32+
- name: 🛠️ Setup PHP
33+
uses: shivammathur/setup-php@2.30.4
34+
with:
35+
php-version: ${{ matrix.php-version }}
36+
extensions: curl, libxml, mbstring, zip, fileinfo, decimal, pdo, pdo_mysql
37+
ini-values: error_reporting=E_ALL
38+
coverage: none
39+
2540
- name: 📦 Check out the codebase
26-
uses: actions/checkout@v4
41+
uses: actions/checkout@v4.1.6
2742
with:
2843
fetch-depth: 0
2944

30-
- name: 🛠️ Setup PHP
31-
uses: shivammathur/setup-php@v2
45+
- name: 🛠️ Setup problem matchers
46+
run: |
47+
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
48+
49+
- name: 🤖 Validate composer.json and composer.lock
50+
run: make validate-composer
51+
52+
- name: 🔍 Get composer cache directory
53+
uses: wayofdev/gh-actions/actions/composer/get-cache-directory@v3.1.0
3254
with:
33-
php-version: ${{ matrix.php }}
34-
extensions: curl, libxml, mbstring, zip, fileinfo, decimal
35-
ini-values: error_reporting=E_ALL
36-
tools: composer:v2
55+
working-directory: app
3756

38-
- name: ♻️ Restore cached backend dependencies
39-
id: cached-composer-dependencies
40-
uses: actions/cache@v4
57+
- name: ♻️ Restore cached dependencies installed with composer
58+
uses: actions/cache@v4.0.2
4159
with:
42-
path: vendor
43-
key: vendor-${{ runner.os }}-${{ hashFiles('**/composer.lock') }}-${{ matrix.php }}
60+
path: ${{ env.COMPOSER_CACHE_DIR }}
61+
key: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}
62+
restore-keys: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-
4463

45-
- name: 📥 Install backend dependencies
46-
if: steps.cached-composer-dependencies.outputs.cache-hit != 'true'
47-
run: cd app && composer install
64+
- name: 📥 Install "${{ matrix.dependencies }}" dependencies with composer
65+
uses: wayofdev/gh-actions/actions/composer/install@v3.1.0
66+
with:
67+
working-directory: app
68+
dependencies: ${{ matrix.dependencies }}
4869

4970
- name: 📤 Deploy production environment
5071
uses: deployphp/action@v1
@@ -54,14 +75,10 @@ jobs:
5475
deployer-version: 7.4.0
5576
sub-directory: app
5677
env:
57-
DEPLOYER_STAGING_SLACK_WEBHOOK: ${{ secrets.DEPLOYER_STAGING_SLACK_WEBHOOK }}
58-
DEPLOYER_STAGING_REMOTE_USER: ${{ secrets.DEPLOYER_STAGING_REMOTE_USER }}
59-
DEPLOYER_STAGING_HOST: "staging.laravel-starter-tpl.wayof.dev"
60-
DEPLOYER_STAGING_BRANCH: "develop"
6178
DEPLOYER_PROD_SLACK_WEBHOOK: ${{ secrets.DEPLOYER_PROD_SLACK_WEBHOOK }}
6279
DEPLOYER_PROD_REMOTE_USER: ${{ secrets.DEPLOYER_PROD_REMOTE_USER }}
63-
DEPLOYER_PROD_HOST: "prod.laravel-starter-tpl.wayof.dev"
64-
DEPLOYER_PROD_BRANCH: "master"
80+
DEPLOYER_PROD_HOST: prod.laravel-starter-tpl.wayof.dev
81+
DEPLOYER_PROD_BRANCH: master
6582

6683
- name: 📦 Create sentry release
6784
uses: getsentry/action-release@v1

.github/workflows/deploy-staging.yml

Lines changed: 41 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,44 +7,65 @@ on: # yamllint disable-line rule:truthy
77

88
name: 🚀 Deploy to staging
99

10+
env:
11+
APP_RUNNER: 'cd app &&'
12+
1013
concurrency: staging
1114

1215
jobs:
1316
deployment:
17+
timeout-minutes: 8
1418
runs-on: ${{ matrix.os }}
1519
strategy:
16-
fail-fast: true
1720
matrix:
18-
os: ["ubuntu-22.04"]
19-
php: ["8.3"]
21+
os:
22+
- ubuntu-latest
23+
php-version:
24+
- '8.3'
25+
dependencies:
26+
- locked
2027
environment:
2128
name: staging
2229
url: https://staging.laravel-starter-tpl.wayof.dev
2330

2431
steps:
32+
- name: 🛠️ Setup PHP
33+
uses: shivammathur/setup-php@2.30.4
34+
with:
35+
php-version: ${{ matrix.php-version }}
36+
extensions: curl, libxml, mbstring, zip, fileinfo, decimal, pdo, pdo_mysql
37+
ini-values: error_reporting=E_ALL
38+
coverage: none
39+
2540
- name: 📦 Check out the codebase
26-
uses: actions/checkout@v4
41+
uses: actions/checkout@v4.1.6
2742
with:
2843
fetch-depth: 0
2944

30-
- name: 🛠️ Setup PHP
31-
uses: shivammathur/setup-php@v2
45+
- name: 🛠️ Setup problem matchers
46+
run: |
47+
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
48+
49+
- name: 🤖 Validate composer.json and composer.lock
50+
run: make validate-composer
51+
52+
- name: 🔍 Get composer cache directory
53+
uses: wayofdev/gh-actions/actions/composer/get-cache-directory@v3.1.0
3254
with:
33-
php-version: ${{ matrix.php }}
34-
extensions: curl, libxml, mbstring, zip, fileinfo, decimal
35-
ini-values: error_reporting=E_ALL
36-
tools: composer:v2
55+
working-directory: app
3756

38-
- name: ♻️ Restore cached backend dependencies
39-
id: cached-composer-dependencies
40-
uses: actions/cache@v4
57+
- name: ♻️ Restore cached dependencies installed with composer
58+
uses: actions/cache@v4.0.2
4159
with:
42-
path: vendor
43-
key: vendor-${{ runner.os }}-${{ hashFiles('**/composer.lock') }}-${{ matrix.php }}
60+
path: ${{ env.COMPOSER_CACHE_DIR }}
61+
key: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}
62+
restore-keys: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-
4463

45-
- name: 📥 Install backend dependencies
46-
if: steps.cached-composer-dependencies.outputs.cache-hit != 'true'
47-
run: cd app && composer install
64+
- name: 📥 Install "${{ matrix.dependencies }}" dependencies with composer
65+
uses: wayofdev/gh-actions/actions/composer/install@v3.1.0
66+
with:
67+
working-directory: app
68+
dependencies: ${{ matrix.dependencies }}
4869

4970
- name: 📤 Deploy staging environment
5071
uses: deployphp/action@v1
@@ -56,11 +77,7 @@ jobs:
5677
env:
5778
DEPLOYER_STAGING_SLACK_WEBHOOK: ${{ secrets.DEPLOYER_STAGING_SLACK_WEBHOOK }}
5879
DEPLOYER_STAGING_REMOTE_USER: ${{ secrets.DEPLOYER_STAGING_REMOTE_USER }}
59-
DEPLOYER_STAGING_HOST: "staging.laravel-starter-tpl.wayof.dev"
60-
DEPLOYER_STAGING_BRANCH: "develop"
61-
DEPLOYER_PROD_SLACK_WEBHOOK: ${{ secrets.DEPLOYER_PROD_SLACK_WEBHOOK }}
62-
DEPLOYER_PROD_REMOTE_USER: ${{ secrets.DEPLOYER_PROD_REMOTE_USER }}
63-
DEPLOYER_PROD_HOST: "prod.laravel-starter-tpl.wayof.dev"
64-
DEPLOYER_PROD_BRANCH: "master"
80+
DEPLOYER_STAGING_HOST: staging.laravel-starter-tpl.wayof.dev
81+
DEPLOYER_STAGING_BRANCH: develop
6582

6683
...

0 commit comments

Comments
 (0)