-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (58 loc) · 2.1 KB
/
deploy-production.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
name: Deploy to production
on:
workflow_call:
inputs:
ACTION:
description: Action to be performed
default: deploy
type: string
required: true
URL:
required: true
type: string
PHP_VERSION:
description: PHP version with which the coding standard analysis is to be executed.
default: "8.1"
required: false
type: string
secrets:
SSH_PRIVATE_KEY:
description: Private key to access deploy server
required: true
COMPOSER_AUTH_JSON:
description: Authentication for privately hosted packages and repositories as a JSON formatted object.
required: false
jobs:
# Deploy
deploy:
name: Deploying to ${{ github.ref == 'refs/heads/main' && 'production' || 'staging' }}
# runs-on: ubuntu-latest
runs-on: self-hosted
env:
HOME: /root
COMPOSER_ALLOW_SUPERUSER: 1
COMPOSER_AUTH: "${{ secrets.COMPOSER_AUTH_JSON }}"
environment:
name: production
url: ${{ inputs.URL }}
steps:
- uses: actions/checkout@v4
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Disable host key check
run: echo -e "Host *\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
- name: Prepend /usr/local/bin to PATH
run: |
echo "PATH=/usr/local/bin:$PATH" >> $GITHUB_ENV
echo "PATH=/usr/local/bin:$PATH" >> $HOME/.bashrc
echo "PATH=/usr/local/bin:$PATH" >> $HOME/.profile
echo "PATH=/usr/local/bin:$PATH" >> $HOME/.bash_profile
- name: Composer setup
uses: Humanoidfr/humanoid-github-workflows/.github/actions/composer@main
with:
PHP_VERSION: ${{ inputs.PHP_VERSION }}
COMPOSER_CONFIG: ${{ vars.COMPOSER_CONFIG_JSON }}
COMPOSER_ARGS: '-d tools/deployer --prefer-dist --no-dev'
- name: Execution ${{ inputs.ACTION }} to production
run: ./tools/deployer/vendor/bin/dep ${{ inputs.ACTION }} -vv stage=production