Pass refspec and version on the CLI #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy localdev (reusable) | ||
on: | ||
workflow_call: | ||
inputs: | ||
catalog_git_refspec: | ||
required: true | ||
type: string | ||
catalog_git_version: | ||
required: true | ||
type: string | ||
playbooks_repo: | ||
required: true | ||
type: string | ||
playbooks_repo_ref: | ||
required: true | ||
type: string | ||
jobs: | ||
deploy-localdev-reusable: | ||
runs-on: 'ubuntu-22.04' | ||
timeout-minutes: 15 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ inputs.playbooks_repo }} | ||
ref: ${{ inputs.playbooks_repo_ref }} | ||
- name: Create LXC container | ||
uses: lkiesow/setup-lxc-container@v1 | ||
id: lxc | ||
with: | ||
dist: ubuntu | ||
release: jammy | ||
name: librivox.org | ||
- name: Run localdev.yaml playbook | ||
uses: dawidd6/action-ansible-playbook@v2 | ||
with: | ||
playbook: localdev.yaml | ||
inventory: | | ||
[localdev] | ||
${{ steps.lxc.outputs.ip }} ansible_user=root ci_env=development ci_log_threshold=4 | ||
options: | ||
--verbose | ||
# Set these on the CLI options to make sure they take precedence | ||
-e "catalog_git_refspec=${{ inputs.catalog_git_refspec }}" | ||
-e "catalog_git_version=${{ inputs.catalog_git_version }}" | ||
- name: Ensure resulting website health | ||
# This relies on the LXC container creation step having added an | ||
# /etc/hosts for librivox.org pointing to the container. | ||
uses: notartom/website-healthcheck@v6 | ||
with: | ||
web-url: "https://librivox.org/dust-of-the-desert-by-robert-welles-ritchie/" | ||
scan-for-text: "BENICIA" | ||
insecure: true | ||
- name: Run unit tests | ||
run: | | ||
ssh librivox.org 'cd /librivox/www/librivox.org/catalog && XDEBUG_MODE=coverage vendor/bin/phpunit -c application/tests' |