Nightly Build #130
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
name: Nightly Build | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * *' # Runs at midnight UTC every day | |
jobs: | |
build-and-release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
ref: develop | |
- name: Check for changes since last successful build | |
id: check_tag | |
run: | | |
TAG_FOUND=$(git tag --contains HEAD | grep -E '.*-dev-nightly.*' || true) | |
if [ -n "$TAG_FOUND" ]; then | |
echo "Skipping nightly build: current commit is already a nightly build: $TAG_FOUND" | |
exit 78 # Neutral exit to stop workflow | |
else | |
echo "No nightly tag found on the current commit. Building new nightly." | |
fi | |
- name: Set up Python | |
uses: actions/setup-python@master | |
with: | |
python-version: '3.10' # Specify the Python version. | |
- name: Configure Git | |
run: | | |
git config user.name "github-actions" | |
git config user.email "[email protected]" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install Dependencies | |
run: | | |
sudo apt update | |
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y libreoffice | |
python -m pip install --upgrade pip | |
pip install -r ./requirements.txt | |
- name: Run Make nightly | |
run: make nightly | |
- name: Get NIGHTLY_VERSION from _VERSION | |
id: version | |
run: | | |
VERSION_FILE="./source/_VERSION" | |
if [ -f "$VERSION_FILE" ]; then | |
echo "NIGHTLY_VERSION=$(cat $VERSION_FILE)" >> $GITHUB_ENV | |
echo "NIGHTLY_VERSION=$(cat $VERSION_FILE)" >> $GITHUB_OUTPUT | |
else | |
echo "Cannot load NIGHTLY_VERSION from $VERSION_FILE" | |
exit 1 | |
fi | |
- name: Create and Upload Release Assets | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ steps.version.outputs.NIGHTLY_VERSION }} # Uses the tag name | |
name: Nightly Build ${{ steps.version.outputs.NIGHTLY_VERSION }} | |
draft: true | |
prerelease: false | |
files: | | |
./dist/docx/DENT-OIP.docx | |
./dist/pdf/DENT-OIP.pdf | |
./source/tables/codes.csv | |
./source/tables/views.csv | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish HTML to gh-pages branch | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./dist/html/ | |
destination_dir: nightly |