💾 Export Geotribu Mastodon accounts and lists #87
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: "💾 Export Geotribu Mastodon accounts and lists" | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: "0 5 * * SUN" # weekly on sundays | |
workflow_dispatch: # to trigger manually | |
env: | |
LANG: "fr_FR.UTF-8" | |
LC_ALL: "fr_FR.UTF-8" | |
LC_TIME: "fr_FR.UTF-8" | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
id-token: write | |
pages: write | |
jobs: | |
run: | |
name: Export des données du compte Geotribu sur Github Pages | |
runs-on: ubuntu-latest | |
if: github.repository == 'geotribu/geo-mastodon-comptes-listes' | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Get source code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/[email protected] | |
with: | |
cache: "pip" | |
cache-dependency-path: "requirements.txt" | |
python-version: 3.12 | |
- name: Install dependencies | |
# TODO: extra for mastodon only | |
run: | | |
python -m pip install -U pip setuptools wheel | |
python -m pip install -U -r requirements.txt | |
- name: Export geotribu's mastodon lists and accounts | |
env: | |
GEOTRIBU_MASTODON_API_ACCESS_TOKEN: ${{ secrets.GEOTRIBU_MASTODON_API_ACCESS_TOKEN }} | |
run: | | |
geotribu social mastodon-export -w export/ | |
- name: Save build doc as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: export-mastodon | |
path: export/ | |
if-no-files-found: error | |
retention-days: 1 | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
- name: Generate Directory Listings | |
uses: jayanta525/[email protected] | |
with: | |
FOLDER: export/ | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
with: | |
path: export/ | |
- name: Deploy to GitHub Pages | |
id: deployment | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
uses: actions/deploy-pages@v4 | |