Artifacts #15
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: Generate DB and Create Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| schedule: | |
| - cron: '0 0 * * *' # Run daily at midnight UTC | |
| workflow_dispatch: # Allows triggering the workflow manually from the GitHub UI | |
| # Add permissions configuration | |
| permissions: | |
| contents: write # Required for creating releases | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| org: [jupyter, jupyterlab, jupyter-book, jupyter-server, jupyterhub] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 # Checkout the repository code | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' # Use your desired Python version | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Create data directory | |
| run: mkdir -p data # Ensure the data directory exists | |
| - name: Run database generation script | |
| run: python scripts/download_issues.py ${{ matrix.org }} # Execute script with org argument | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.PAT }} # Pass PAT as GITHUB_TOKEN to the script | |
| - name: Upload job outputs as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: job-output-artifact | |
| path: ./data | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download artifact from build job | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: job-output-artifact | |
| path: ./data # Download into a specific directory | |
| - name: Get current date for release name | |
| id: get_date | |
| run: echo "RELEASE_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV # Set environment variable with current date and time | |
| - name: Create Release and Upload Database File | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| # Use the current date for the release name | |
| name: ${{ env.RELEASE_DATE }} | |
| # Use a consistent tag name that will be overwritten | |
| # This way we aren't publishing an ever-increasing amount of data. | |
| tag_name: latest | |
| # Attach all files from the data directory | |
| files: data/* | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.PAT }} # Use personal access token instead of default token |