Merge pull request #379 from getwilds/add-vrs-python #363
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: Docker Build, Upload, and Update Descriptions | |
| on: | |
| push: | |
| branches: | |
| - 'main' | |
| workflow_dispatch: | |
| inputs: | |
| image_directory: | |
| description: 'Directory name containing the Dockerfile to build/push (e.g., "samtools")' | |
| required: true | |
| type: string | |
| permissions: | |
| contents: write | |
| packages: write | |
| jobs: | |
| docker: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| steps: | |
| - name: Generate token | |
| id: generate_token | |
| uses: actions/create-github-app-token@v1 | |
| with: | |
| app-id: ${{ secrets.APP_ID }} | |
| private-key: ${{ secrets.APP_PRIVATE_KEY }} | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ steps.generate_token.outputs.token }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| version: "0.6.16" | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Login to DockerHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USER }} | |
| password: ${{ secrets.DOCKERHUB_PW }} | |
| - name: Install Docker Scout | |
| run: | | |
| curl -fsSL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh -o install-scout.sh | |
| sh install-scout.sh | |
| - name: Run Docker Update Process | |
| run: | | |
| if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
| # Manual trigger - use the specified directory | |
| uv run .github/scripts/docker_update.py ${{ github.event.inputs.image_directory }} | |
| else | |
| # Push event - use git diff logic | |
| uv run .github/scripts/docker_update.py | |
| fi | |
| env: | |
| GITHUB_REF_NAME: ${{ github.ref_name }} | |
| DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }} | |
| DOCKERHUB_PW: ${{ secrets.DOCKERHUB_PW }} | |
| - name: Generate fresh token for git operations | |
| id: generate_fresh_token | |
| uses: actions/create-github-app-token@v1 | |
| with: | |
| app-id: ${{ secrets.APP_ID }} | |
| private-key: ${{ secrets.APP_PRIVATE_KEY }} | |
| owner: getwilds | |
| repositories: wilds-docker-library | |
| - name: Stash changes before fresh checkout | |
| run: git stash push -u -m "CVE reports and vulnerability updates" | |
| - name: Checkout with fresh token | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ steps.generate_fresh_token.outputs.token }} | |
| clean: false | |
| - name: Reinstall dependencies for commit step | |
| run: | | |
| uv venv | |
| uv pip install gitpython requests | |
| - name: Restore stashed changes | |
| run: git stash pop | |
| - name: Commit CVE Reports | |
| run: uv run .github/scripts/commit_cve_reports.py | |
| env: | |
| GITHUB_REF_NAME: ${{ github.ref_name }} | |
| GITHUB_EVENT_NAME: ${{ github.event_name }} | |
| GITHUB_HEAD_REF: ${{ github.head_ref }} | |
| GH_APP_TOKEN: ${{ steps.generate_fresh_token.outputs.token }} |