GitHub Action
Trellis Deploy
This action deploys your bedrock site to your trellis environment.
This action expects trellis in the $GITHUB_WORKSPACE/trellis
subdirectory.
- In your repository, go to the Settings > Secrets menu and create a new secret called
vault_pass
. Put the vault pass into the contents field. - In your workflow definition file, add
xilonz/[email protected]
. See next example:
# .github/workflows/my-workflow.yml
jobs:
my_job:
...
container:
image: cytopia/ansible:2.7-tools
env:
ANSIBLE_HOST_KEY_CHECKING: false
ANSIBLE_STRATEGY_PLUGINS: /usr/lib/python3.6/site-packages/ansible_mitogen/plugins/strategy
ANSIBLE_STRATEGY: mitogen_linear
steps:
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- uses: actions/checkout@v1
- uses: xilonz/[email protected]
with:
vault_password: ${{ secrets.vault_pass }}
site_env: production
site_name: example.com
You can also choose to deploy multiple sites at once by searching for site_key == site_value
# .github/workflows/my-workflow.yml
jobs:
my_job:
...
container:
image: cytopia/ansible:2.7-tools
env:
ANSIBLE_HOST_KEY_CHECKING: false
ANSIBLE_STRATEGY_PLUGINS: /usr/lib/python3.6/site-packages/ansible_mitogen/plugins/strategy
ANSIBLE_STRATEGY: mitogen_linear
steps:
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- uses: actions/checkout@v1
- uses: xilonz/[email protected]
with:
vault_password: ${{ secrets.vault_pass }}
site_env: production
site_key: repo
site_value: [email protected]:${{ github.repository }}
This action has not been tested with sage 9. Please let me know if this works for you.
I haven't got a definitive answer for you. actions/checkout@v1
is able to chekckout other repos, but I haven't got that to work. You could try something like adding the following steps:
# .github/workflows/my-workflow.yml
# $GITHUB_WORKSPACE is set by actions/checkout
...
- uses: actions/checkout@v1
- name: Move site to subdirectory
run: |
mv $GITHUB_WORKSPACE /tmp/repo
mkdir -p $GITHUB_WORKSPACE
mv /tmp/repo $GITHUB_WORKSPACE/$SITE_LOCAL_PATH
ls -la $GITHUB_WORKSPACE/$SITE_LOCAL_PATH
- name: Clone Trellis Repo
run: git clone --verbose --branch $TRELLIS_BRANCH --depth 1 $TRELLIS_REPO $GITHUB_WORKSPACE/trellis
...
As a note to my future self, in order to work on this repo:
- Clone it
- Run
yarn install
to fetch dependencies - hack hack hack
node index.js
(inputs are passed throughINPUT_
env vars)- Run
./node_modules/.bin/ncc build index.js
to updatedist/index.js
, which is the file actually run - Read https://help.github.com/en/articles/creating-a-javascript-action if unsure.
- Maybe update the README example when publishing a new version.
Trellis Action is a Steenbergen Design project and maintained by Arjan Steenbergen
Special thanks to the Roots team whose Trellis make this project possible.
Copyright 2019 Steenbergen design. Code released under the MIT license.