.github/workflows/maps-build.yml #99
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
--- | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '42 23 23 * *' | |
push: | |
jobs: | |
createmaps: | |
runs-on: self-hosted | |
steps: | |
- name: checkout code | |
uses: actions/checkout@v4 | |
- name: ssh-agent with keys for REPO and DEPLOY hosts | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: | | |
${{ secrets.REPO_KEY }} | |
${{ secrets.DEPLOY_KEY }} | |
- name: generate ssh dir | |
run: mkdir -p ~/.ssh && chmod 0700 ~/.ssh | |
- name: add sshkey of xcsoar's mapgen repository to known_hosts | |
run: ssh-keyscan -p ${{ secrets.REPO_PORT }} ${{ secrets.REPO_HOST }} >> ~/.ssh/known_hosts | |
- name: add sshkey of download host to known_hosts | |
run: ssh-keyscan -p ${{ secrets.DEPLOY_PORT }} ${{ secrets.DEPLOY_HOST }} >> ~/.ssh/known_hosts | |
- name: copy checksums file from xcsoar's mapgen repo | |
run: scp -v -P ${{ secrets.REPO_PORT }} ${{ secrets.REPO_USER }}@${{ secrets.REPO_HOST }}:${{ secrets.REPO_PATH }}/checksums $GITHUB_WORKSPACE/checksums | |
- name: update checksums of maps.config.js | |
run: cd data && $GITHUB_WORKSPACE/bin/replacechecksum maps.config.js $GITHUB_WORKSPACE/checksums | |
- name: deploy maps.config.js and checksums to xcsoar's mapgen repo | |
run: scp -v -P ${{ secrets.REPO_PORT }} checksums ./data/maps.config.js ${{ secrets.REPO_USER }}@${{ secrets.REPO_HOST }}:${{ secrets.REPO_PATH }}/ | |
- name: pull docker image | |
run: docker pull ghcr.io/xcsoar/mapgen-worker | |
- name: run mapgen-worker and produce maps | |
run: docker run -u $(id -u ${USER}):$(id -g ${USER}) --mount type=bind,source="$(pwd)/data",target=/opt/mapgen/data --entrypoint /opt/mapgen/bin/generate-maps -w /opt/mapgen/data ghcr.io/xcsoar/mapgen-worker | |
- name: generate checksum files | |
run: ${GITHUB_WORKSPACE}/bin/createchecksums ./data/ | |
- name: sync maps and config to deployment directory | |
run: rsync -e 'ssh -o StrictHostKeyChecking=no' -arzv --delete ./data/maps.config.js ./data/*.xcm ./data/*.sha256 ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }}:${{ secrets.DEPLOY_PATH }} |