Skip to content

shlokas added

shlokas added #489

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Generate panchAngas
on:
push:
branches: [ '*' ]
pull_request:
branches: [ '*' ]
workflow_dispatch:
inputs:
year:
default: ''
required: false
description: 'Eg. 2023'
jobs:
generate:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]
# python-version: [3.5, 3.6, 3.7, 3.8]
steps:
- name: Inject slug/short variables
uses: rlespinasse/[email protected]
- uses: actions/checkout@master
with:
repository: jyotisham/jyotisha
submodules: 'false'
fetch-depth: 1 # Because of this, you will fail to push refs to dest repo
- name: Get current date
id: date
if: "${{ github.event.inputs.year == '' }}"
run: | # No space after + above.
echo "date={$(date +'%Y-%m-%d')}" >> $GITHUB_OUTPUT
echo "year=$(date +'%Y')" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
- name: Init submodules, update some
run: |
set -o xtrace
pwd
git submodule update --init --recursive
git submodule foreach -q --recursive 'git checkout $(git config -f $toplevel/.gitmodules submodule.$name.branch || echo master)'
- name: Set content to pull request
if: ${{ github.event_name == 'pull_request'}}
uses: actions/checkout@master
with:
path: jyotisha/panchaanga/temporal/festival/data
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
# python -m pip install git+https://github.com/astropy/astropy@master -U
- name: Build package
run: |
python -m pip install .
- name: Regenerate calendars
run: |
python -m "jyotisha.panchaanga.writer.generation_project" --year=${{ steps.date.outputs.year }}${{github.event.inputs.year}}
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: "0.119.0"
- name: Build hugo site pages
id: hugo_build
run: |
cd hugo-source
rm -rf build_github
hugo
cd ..
# MD files are useful for certain bots.
- name: Deploy md
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.event_name != 'pull_request' && steps.hugo_build.conclusion == 'success'}}
with:
personal_token: ${{ secrets.GH_VISH }}
external_repository: jyotisham/jyotisha
publish_dir: ./hugo-source/content/output
publish_branch: generated-output
keep_files: true
# uses: s0/git-publish-subdir-action@develop
# env:
# REPO: self
# BRANCH: generated-output
# FOLDER: ./hugo-source/content/output
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy html
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.event_name != 'pull_request' && steps.hugo_build.conclusion == 'success'}}
with:
external_repository: jyotisham/jyotisha
personal_token: ${{ secrets.GH_VISH }}
publish_dir: ./hugo-source/build_github