-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathgithub-actions.yml
60 lines (55 loc) · 1.78 KB
/
github-actions.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
# This file would need to be placed in .github/workflows/deploy.yaml for example
# In this example, the branches 'master' and 'staging' are used for the production and staging branch, respectively.
name: Build and Deploy
on:
push:
branches:
- 'master'
- 'staging'
env:
COMPOSER_CACHE_DIR: /tmp/composer-cache
jobs:
build:
runs-on: ubuntu-latest
container: quay.io/hypernode/deploy:3-php8.2-node18
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-composer
- uses: webfactory/ssh-agent@v0.7.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- run: hypernode-deploy build -vvv
env:
DEPLOY_COMPOSER_AUTH: ${{ secrets.DEPLOY_COMPOSER_AUTH }}
- name: archive production artifacts
uses: actions/upload-artifact@v3
with:
name: deployment-build
path: build/build.tgz
deploy:
needs: build
runs-on: ubuntu-latest
container: quay.io/hypernode/deploy:3-php8.2-node18
steps:
- uses: actions/checkout@v3
- name: download build artifact
uses: actions/download-artifact@v3
with:
name: deployment-build
path: build/
- uses: webfactory/ssh-agent@v0.7.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- run: mkdir -p $HOME/.ssh
- name: deploy to staging
if: github.ref == 'refs/heads/staging'
run: hypernode-deploy deploy staging -vvv
- name: deploy to production
if: github.ref == 'refs/heads/master'
run: hypernode-deploy deploy production -vvv
- name: cleanup acquired resources
if: ${{ always() }}
run: hypernode-deploy cleanup