macOS and iOS SOFA Scan #202
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: macOS SOFA Scan | |
on: | |
schedule: | |
# Monday, Tuesday, Thursday, and Friday every 1 hour from 5:00 PM to 8:00 PM CET | |
- cron: '0 17-20 * * 1,2,3,4,5' | |
# On every day every 4 hours | |
- cron: '30 */4 * * *' | |
workflow_dispatch: | |
jobs: | |
build-and-run: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
os_type: [macOS] # Run only macOS tasks in this workflow | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Build Docker image | |
run: docker build . -t sofa_scan | |
- name: Run Docker container | |
run: docker run --name sofa_scan_container -e OS_TYPE=${{ matrix.os_type }} sofa_scan | |
- name: Copy resulting JSON files from container to host | |
run: | | |
docker cp sofa_scan_container:/app/macos_data_feed.json v1/. || true | |
docker cp sofa_scan_container:/app/ios_data_feed.json v1/. || true | |
docker cp sofa_scan_container:/app/time-series.csv . | |
- name: Commit and push if changes are detected | |
run: | | |
timestamp=$(date +'%Y-%m-%d %H:%M:%S') | |
git config --global user.name 'github-actions' | |
git config --global user.email '[email protected]' | |
git add v1/*.json time-series.csv | |
git commit -m "Update ${{ matrix.os_type }} SOFA data - $timestamp" -a || exit 0 | |
git push |