Skip to content

Builder

Builder #787

Workflow file for this run

name: 'Builder'
on:
# push:
# branches:
# - master
schedule:
# 19:00 GMT (00:00 UTC+5)
- cron: '0 19 * * *'
workflow_dispatch:
inputs:
selected_distros:
description: 'Selected distros'
output_dir:
description: 'Output directory'
timezone:
description: 'Timezone'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Initiate variables
run: |
cat << EOF >> $GITHUB_ENV
DATE=$(date +'%d-%m-%Y')
OUTPUT_DIR=$([ -z $OUTPUT_DIR ] && echo "${{ secrets.OUTPUT_DIR }}" | base64 -d || echo ${{ github.event.inputs.output_dir }})
SELECTED_DISTROS=$([ -z $SELECTED_DISTROS ] && echo "${{ secrets.SELECTED_DISTROS }}" | base64 -d || echo ${{ github.event.inputs.selected_distros }})
TIMEZONE=$([ -z $TIMEZONE ] && echo "${{ secrets.TIMEZONE }}" | base64 -d || echo ${{ github.event.inputs.timezone }})
EOF
- name: Set timezone
uses: zcong1993/setup-timezone@master
with:
timezone: ${{ env.TIMEZONE }}
- name: Install dependencies
run: pip install -r requirements.txt
- name: Build a repo
continue-on-error: true
run: python -u src/main.py -g -o ${{ env.OUTPUT_DIR }} -d ${{ env.SELECTED_DISTROS }}
- name: Upload a named artifact
uses: actions/upload-artifact@v3
with:
name: ddrg_${{ env.DATE }}
path: ${{ env.OUTPUT_DIR }}
retention-days: 90
- name: Upload an artifact for GitHub Pages
uses: actions/upload-pages-artifact@v1
with:
path: ${{ env.OUTPUT_DIR }}
retention-days: 1
deploy:
name: Deploy
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
steps:
- name: Deploy the repo to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
- name: Download the artifact
uses: actions/download-artifact@v3
- name: Unarchive the artifact
run: |
cd github-pages
tar -xf artifact.tar
rm artifact.tar
- name: Deploy the repo to the custom server
uses: appleboy/scp-action@master
continue-on-error: true
with:
host: ${{ secrets.SSH_HOST }}
port: ${{ secrets.SSH_PORT }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
source: github-pages
target: ${{ secrets.SSH_DIR }}
strip_components: 1
rm: true