Basic course images #45
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 | |
on: | |
pull_request: {} | |
push: | |
branches: | |
- main | |
env: | |
PANTS_CONFIG_FILES: +['pants.ci.toml'] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Initialize Pants | |
uses: pantsbuild/actions/init-pants@main | |
with: | |
# cache0 makes it easy to bust the cache if needed | |
gha-cache-key: cache0-py${{ matrix.python_version }} | |
named-caches-hash: ${{ hashFiles('lockfiles/*.json', '**/something-else.lock') }} | |
cache-lmdb-store: 'true' | |
- name: Check BUILD files | |
run: | | |
pants tailor --check update-build-files --check :: | |
# - name: Lint | |
# run: | | |
# pants lint :: | |
- name: Test | |
run: | | |
pants test :: | |
- name: Package | |
run: | | |
# We also smoke test that our release process will work by running `package`. | |
pants package :: | |
- name: Log in to registry | |
if: github.ref_name == 'main' | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin | |
- name: Publish | |
if: github.ref_name == 'main' | |
run: | | |
pants publish src/docker:: | |
- name: Upload pants log | |
uses: actions/upload-artifact@v3 | |
with: | |
name: pants-log | |
path: .pants.d/pants.log | |
deploy: | |
if: github.ref_name == 'main' | |
runs-on: ubuntu-latest | |
environment: srv501663.hstgr.cloud | |
needs: test | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Run Playbook | |
uses: dawidd6/action-ansible-playbook@v2 | |
with: | |
playbook: src/ansible/playbook.yaml | |
requirements: src/ansible/requirements.yaml | |
key: ${{secrets.SSH_PRIVATE_KEY}} | |
vault_password: ${{secrets.VAULT_PASSWORD}} | |
inventory: | | |
[webservers] | |
srv501663.hstgr.cloud ansible_user=root | |
known_hosts: | | |
srv501663.hstgr.cloud ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBARIuGrJyMNtdJdoRnUxPhPMYcvNQkcb5CxCXGc5I3mUv7akdlIxAX1Bz6vMmMBAU8iPtCI//T3L9aIzt7WPAwM= |