Skip to content

macOS and iOS SOFA Scan #690

macOS and iOS SOFA Scan

macOS and iOS SOFA Scan #690

name: macOS and iOS 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
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Build Docker image
run: docker build . -t sofa_scan
- name: Run Docker container with macOS and iOS arguments
run: |
docker run --name sofa_scan_container \
-e TIMESTAMP_FILE_PATH=/app/v1/timestamp.json \
-v $(pwd)/v1:/app/v1 sofa_scan macOS iOS
- name: Copy resulting JSON files from container to host
run: |
docker cp sofa_scan_container:/app/v1/timestamp.json v1/. || echo "Failed to copy timestamp.json"
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/rss_feed.xml v1/. || true
docker cp sofa_scan_container:/app/cache . || echo "Failed to copy cache files"
docker cp sofa_scan_container:/app/time-series.csv .
- name: List contents of v1
run: ls -la v1/
- 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 v1/*.xml cache/*.json time-series.csv
git commit -m "Update SOFA data - $timestamp" -a || exit 0
git push