Skip to content

gh-pages deployment #2002

gh-pages deployment

gh-pages deployment #2002

# """
# The MIT License (MIT)
# Copyright (c) 2023 pkjmesra
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# """
name: gh-pages deployment
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
#push:
# branches: [ "main" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
schedule:
- cron: '0 20 * * 0-6'
jobs:
# Single deploy job no building
deploy:
environment:
name: github-pages
url: ${{steps.deployment.outputs.page_url}}
runs-on: ubuntu-latest
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: gh-pages
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Cleanup before deployment
timeout-minutes: 5
continue-on-error: true
shell: bash
run: |
rm -rf results
rm -rf screenshots
rm -rf .github
rm -rf docs
rm -rf patterns
rm -rf test
rm -rf pkscreener/classes/*.py
rm -rf pkscreener/ml/*.*
rm -rf pkscreener/*.md
rm -rf pkscreener/*.ini
rm -rf pkscreener/*.py
rm -rf pkscreener/*.xlsx
rm -rf pkscreener/*.ttf
rm -rf Backtest-Reports/*_OneLine_Summary.html
- name: Upload Artifact
uses: actions/upload-pages-artifact@v2
with:
# upload entire directory
path: '.'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
# - name: Configure .env.dev file
# shell: bash
# env:
# CHAT_ID_DEV : ${{secrets.CHAT_ID_DEV}}
# TOKEN_DEV : ${{secrets.TOKEN_DEV}}
# CHAT_IDADMIN_DEV : ${{secrets.CHAT_IDADMIN_DEV}}
# run: |
# python3 -c "import os; file = open('.env.dev', 'w'); file.write('CHAT_ID='+os.environ['CHAT_ID_DEV']+'\n'); file.write('TOKEN='+os.environ['TOKEN_DEV']+'\n'); file.write('chat_idADMIN='+os.environ['CHAT_IDADMIN_DEV']+'\n'); file.close()"
# - name: Send notification about deployment
# shell: bash
# env:
# NOTIFY_USER : '-1001785195297'
# run: |
# pip3 install PKDevTools
# python3 -c "import os; from PKDevTools.classes.Telegram import send_message; send_message(message='Hello! The gh-pages has been deployed.', userID=os.environ['NOTIFY_USER']);"