Daily scrap ⏰ #583
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: Daily scrap ⏰ | |
on: | |
schedule: | |
- cron: '0 6 * * *' | |
# enable manual run | |
workflow_dispatch: | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
jobs: | |
scrap: | |
name: "Scrap 🪝" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v4 | |
- name: Get node v20.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Adapt arbo (1/2) | |
run: sudo mv config /etc/scrapconfig/ && sudo chmod 777 -R /etc/scrapconfig/ | |
- name: Adapt arbo (2/2) | |
run: sudo mkdir -p /var/resources/ && sudo chmod 777 -R /var/resources/ | |
- name: Install dependencies | |
run: cd scrap/ && npm ci | |
- name: Run the scrapper | |
run: cd scrap/ && node . | |
- name: Archive result | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "DailyPictures" | |
path: /var/resources/* | |
package: | |
name: "Package 📦" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v4 | |
- name: Packing up monthly | |
run: ./pack-up.sh "${{ secrets.GITHUB_TOKEN }}" | |
- name: Archive result | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "MonthlyPictures" | |
path: MonthlyPictures | |
deploy: | |
name: "Deploy 🚀" | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
needs: [scrap, package] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout project | |
uses: actions/checkout@v4 | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
- name: Download daily | |
uses: actions/download-artifact@v4 | |
with: | |
name: DailyPictures | |
path: './resources/' | |
- name: List all available daily images | |
run: ls ./resources/*.webp > ./resources/list.txt | |
- name: Group up daily into web folder | |
run: mv resources/ web/ | |
- name: Download monthly | |
uses: actions/download-artifact@v4 | |
with: | |
name: MonthlyPictures | |
path: './monthly-resources/' | |
- name: List all available monthly images | |
run: find ./monthly-resources/ -type f > ./monthly-resources/list.txt | |
- name: Group up montlhy into web folder | |
run: mv monthly-resources/ web/ | |
- name: Upload artifact for GitHub Pages | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: 'web' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |