Art job #121
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: Art job | |
# This workflow is triggered on pushes to the repository. | |
on: | |
# push: | |
# path: | |
# We are saving the cool results here, lets prevent this action to trigger if something is added here. Otherwise this will run forever | |
# - '!art/**' | |
schedule: | |
- cron: "42 00 * * 5" #generate ascii art every Friday (5th day of the week) at 00:42 UTC (GH actions are on UTC time). | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Do art | |
# This job runs on Linux | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get current date | |
id: date | |
run: echo "$(date)" | |
# This is to clone the current repo | |
- uses: actions/checkout@v3 | |
with: | |
path: 'target4art' | |
- name: run the action that generates unique ascii art | |
run: | | |
# Save the current dir for latter commit | |
CURRENT_DIR="$GITHUB_WORKSPACE/target4art" | |
echo $CURRENT_DIR | |
# The previous step clones this repo, just go out of the folder to not mess up two repos in the same place | |
cd / | |
sudo git clone https://github.com/bbaudry/gen-art-action.git gen-art-folder | |
sudo chown $USER:$USER gen-art-folder | |
cd gen-art-folder | |
bash ./cool-genart.sh | |
# COPY the cool result to this repo folder | |
sudo mkdir -p $CURRENT_DIR/art/ | |
sudo cp friday.art $CURRENT_DIR/art/friday-$(date +'%Y-%m-%d').art | |
cd $CURRENT_DIR | |
# Then commit the new art | |
git config --global user.email "[email protected]" | |
git config --global user.name "almyre" | |
git add art/ | |
git commit -m "New art added" | |
sudo git push --force |