🚀 deploy 3.13.0 #115
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
# Many thanks to | |
# https://www.meziantou.net/executing-github-actions-jobs-or-steps-only-when-specific-files-change.htm | |
# for providing the base that this uses | |
name: Push to prod | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
check_for_version_change: | |
runs-on: 'ubuntu-latest' | |
# Declare outputs for next jobs | |
outputs: | |
version_changed: ${{ steps.check_file_changed.outputs.version_changed }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# Checkout as many commits as needed for the diff | |
fetch-depth: 2 | |
- id: check_file_changed | |
run: | | |
# Diff HEAD with the previous commit | |
if git diff HEAD^ HEAD pyproject.toml | grep -q "+version ="; | |
then | |
GOTIME="True" | |
else | |
GOTIME="False" | |
fi | |
echo "::notice title=GOTIME::$GOTIME" | |
# Set the output named "version_changed" | |
echo "version_changed=$GOTIME" >> $GITHUB_OUTPUT | |
deploy: | |
runs-on: 'ubuntu-latest' | |
needs: [ check_for_version_change ] | |
if: needs.check_for_version_change.outputs.version_changed == 'True' | |
steps: | |
- name: executing remote ssh commands using ssh key | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SSH_HOSTNAME }} | |
username: ${{ secrets.SSH_USERNAME }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
port: 22 | |
# this is a non-login shell, so the path has to be manually adjusted | |
# here because bash_profile and bashrc will never run | |
script: | | |
export PATH="${{ secrets.SSH_BASE_PATH }}/.local/bin:$PATH" \ | |
&& ./update.sh | |
ping_bugsnag: | |
runs-on: ubuntu-latest | |
needs: [ check_for_version_change ] | |
if: needs.check_for_version_change.outputs.version_changed == 'True' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12.x' | |
- name: Install Env | |
run: | | |
pip install --upgrade pip | |
pip install poetry | |
echo "VERSION=$(poetry version -s)" >> $GITHUB_ENV | |
- name: Ping Bugsnag | |
run: | | |
curl https://build.bugsnag.com/ \ | |
--request POST \ | |
--header "Content-Type: application/json" \ | |
--data '{ | |
"apiKey": "${{ secrets.BUGSNAG_KEY }}", | |
"appVersion": "${{ env.VERSION }}", | |
"releaseStage": "production", | |
"builderName": "CI", | |
"sourceControl": { | |
"provider": "github", | |
"repository": "https://github.com/itsthejoker/filamentcolors.xyz", | |
"revision": "${{ github.sha }}" | |
} | |
}' |