Skip to content

Instantly share code, notes, and snippets.

View kerridge's full-sized avatar
💭
Full stackin'

kerridge kerridge

💭
Full stackin'
View GitHub Profile
@kerridge
kerridge / build_test_push_django_image.yml
Created September 26, 2021 10:22
Builds a Python Docker image with a Django API. Tests the image before pushing to registry.
name: Build & Push Image
on:
push:
branches: [ main ]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
pull_request:
branches: [ main ]
workflow_dispatch:
@kerridge
kerridge / vultr_centOS_vps_start_script.sh
Created September 26, 2021 10:08
Start script which runs when a Vultr VPS is first deployed. Installs git, opens port 80, adds a new ssh key to GitHub, clones repository passed as env var
#!/bin/bash
# Github access token with read/write access to ssh keys
GH_SSH_ACCESS_TOKEN=<GH_ACCESS_TOKEN>
# SSH URL from the repository to clone
GH_SSH_URL=<GH_SSH_URL>
# Github Username
GH_USERNAME=<GH_USERNAME>
# Name of the application on Vultr
VULTR_APP_NAME=<VULTR_APP_NAME>
@kerridge
kerridge / if_changes_in_subdirectory.sh
Created September 26, 2021 09:54
Takes a space separated list of directories and sets GitHub Actions output `true` if any git changes were made in them
#!/bin/bash
echo "=============== list modified files ==============="
git diff --name-only HEAD^ HEAD
echo "========== check paths of modified files =========="
git diff --name-only HEAD^ HEAD > files.txt
# takes multiple directories as input
for search_dir in "$@"; do