Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
upload-cloud

GitHub Action

Trellis Deploy

v0.1.1

Trellis Deploy

upload-cloud

Trellis Deploy

Deploy Trellis, Bedrock and Sage(optional) via Github Actions

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Trellis Deploy

uses: steenbergen-design/[email protected]

Learn more about this action in steenbergen-design/trellis-action

Choose a version

Trellis Deploy GitHub Action

This action deploys your bedrock site to your trellis environment. This action expects trellis in the $GITHUB_WORKSPACE/trellis subdirectory.

Usage

  1. 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.
  2. 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 }}

Known issues, limitations and FAQ

I don't know if this works with sage 9 - yet.

This action has not been tested with sage 9. Please let me know if this works for you.

Trellis isn't in the same repo!

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
    ...

Hacking

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 through INPUT_ env vars)
  • Run ./node_modules/.bin/ncc build index.js to update dist/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.

Credits, Copyright and License

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.