https://gitlab.inf.unibz.it/ado/ado_portal_update_db/-/jobs/147977 #1114
This file contains hidden or 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: Push File | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| copy-file: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 1 | |
| sparse-checkout: | | |
| markdown | |
| sparse-checkout-cone-mode: false | |
| - name: Verify destination token | |
| env: | |
| API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} | |
| run: | | |
| if [ -z "${API_TOKEN_GITHUB}" ]; then | |
| echo "::error::Missing secret API_TOKEN_GITHUB" | |
| exit 1 | |
| fi | |
| - name: Clone destination repository | |
| env: | |
| API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} | |
| run: | | |
| git clone --depth 1 --branch main \ | |
| "https://tiacopino:${API_TOKEN_GITHUB}@github.com/Eurac-Research/ADO.git" \ | |
| destination-repo | |
| - name: Copy markdown and push | |
| env: | |
| API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} | |
| run: | | |
| set -euo pipefail | |
| mkdir -p destination-repo/_posts/markdown | |
| rsync -a --delete markdown/ destination-repo/_posts/markdown/ | |
| cd destination-repo | |
| git config user.email "thomas.iacopino@eurac.edu" | |
| git config user.name "tiacopino" | |
| git add _posts/markdown | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit" | |
| exit 0 | |
| fi | |
| git commit -m "[GHA] Update the files." | |
| git remote set-url origin "https://tiacopino:${API_TOKEN_GITHUB}@github.com/Eurac-Research/ADO.git" | |
| git push origin HEAD:main | |
| feature-extraction: | |
| runs-on: ubuntu-latest | |
| needs: copy-file | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 1 | |
| filter: blob:none | |
| sparse-checkout: | | |
| json/nuts/*.geojson | |
| json/nuts/*-latest-features.json | |
| json/nuts/*.min.geojson | |
| scripts/extract-nuts-features.js | |
| scripts/json-utils.js | |
| sparse-checkout-cone-mode: false | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '18' | |
| - name: Extract features from latest.geojson files | |
| run: node scripts/extract-nuts-features.js | |
| - name: Commit and push extracted features | |
| run: | | |
| git config --local user.email "thomas.iacopino@eurac.edu" | |
| git config --local user.name "tiacopino" | |
| git add --sparse json/nuts/*-latest-features.json | |
| git add --sparse json/nuts/*.min.geojson | |
| git diff --staged --quiet || git commit -m "[GHA] Update minified features and geojson files" | |
| git push | |
| deployment: | |
| runs-on: ubuntu-latest | |
| needs: feature-extraction | |
| steps: | |
| - name: Deploy to production on vercel | |
| env: | |
| TRIGGERVERCELBUILD: ${{ secrets.TRIGGERVERCELBUILD }} | |
| run: | | |
| set -euo pipefail | |
| curl --fail --silent --show-error \ | |
| --request POST \ | |
| "$TRIGGERVERCELBUILD" |