CI #906
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: CI | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
workflow_call: | |
schedule: | |
- cron: '1 1 * * *' | |
env: | |
MY_GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }} | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
jobs: | |
generate: | |
runs-on: ubuntu-latest | |
name: Generate HTML | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Pages | |
uses: actions/configure-pages@v2 | |
- name: Get Date | |
id: get-date | |
run: | | |
echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Cache fetched data | |
uses: actions/cache@v3 | |
with: | |
path: cache | |
key: osdc-${{ steps.get-date.outputs.date }} | |
- name: Install dependencies | |
run: | | |
pip install -r requirements.txt -c constraints.txt | |
- name: Run code tests | |
run: | | |
pytest -svv test_generate.py | |
- name: Collect data and generate HTML Pages | |
run: | | |
python generate.py | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
if: github.ref == 'refs/heads/main' | |
# Deployment job | |
deploy: | |
if: github.ref == 'refs/heads/main' | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: generate | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 | |