-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdryrun-production.yml
More file actions
67 lines (58 loc) · 2.05 KB
/
dryrun-production.yml
File metadata and controls
67 lines (58 loc) · 2.05 KB
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
65
66
67
# .github/workflows/dryrun-production.yml
##
# Dry-run deploy to a temporary directory in the production environment with Trellis
##
name: 🧪 Dry-run to production
run-name: dry-run-production
on:
workflow_dispatch:
pull_request:
branches: [main]
env:
environment: production
script: |
---
- name: "This is a dry-run, delete the deploy."
ansible.builtin.file:
state: absent
path: "{{ deploy_helper.new_release_path }}"
- name: "This is a dry-run, stop here."
meta: end_play
extra-vars: |
{
"deploy_build_after": [
"{{ playbook_dir }}/roles/deploy/hooks/build-after.yml",
"{{ playbook_dir }}/deploy-hooks/build-after.yml",
"/build-after.yml"
],
"dry_run": true,
"project_root": "/tmp/trellis"
}
jobs:
dryrun-production:
runs-on: ubuntu-latest
steps:
# Checkout the repo
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.base.ref }}
# Create a file with the contents of the script environment variable
- name: Create script file
run: echo "${{ env.script }}" > build-after.yml
# Create a yml file with the contents of the extra-vars
- name: Create extra-vars file
run: |
echo "${{ env.extra-vars }}" > extra-vars.json
# Deploy site to production
- uses: ./.github/actions/trellis-cli
name: Dry-run deploy to production
if: github.event.pull_request.merged || github.event_name == 'workflow_dispatch' || github.repository != 'MWDelaney/trellis-template'
with:
extra-vars: '"@file:/extra-vars.json"'
environment: ${{ env.environment }}
github_token: ${{ secrets.GITHUB_TOKEN }}
trellis_site_slug: ${{ secrets.TRELLIS_SITE_SLUG }}
trellis_deploy_ssh_private_key: ${{ secrets.TRELLIS_DEPLOY_SSH_PRIVATE_KEY }}
trellis_deploy_ssh_known_hosts: ${{ secrets.TRELLIS_DEPLOY_SSH_KNOWN_HOSTS }}
ansible_vault_password: ${{ secrets.ANSIBLE_VAULT_PASSWORD }}
dry_run: true