|
| 1 | +# This is a GitHub workflow defining a set of jobs with a set of steps. |
| 2 | +# ref: https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions |
| 3 | +# |
| 4 | +name: Refreeze Dockerfile.requirements.txt |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + paths: |
| 9 | + - "**/Dockerfile" |
| 10 | + - "**/Dockerfile.requirements.in" |
| 11 | + - "**/Dockerfile.requirements.txt" |
| 12 | + - ".github/workflows/refreeze-dockerfile-requirements-txt.yaml" |
| 13 | + branches: ["main"] |
| 14 | + tags: ["**"] |
| 15 | + workflow_dispatch: |
| 16 | + |
| 17 | +jobs: |
| 18 | + refreeze-dockerfile-requirements-txt: |
| 19 | + name: Refreeze Dockerfile.requirements.txt |
| 20 | + |
| 21 | + # Don't run this job on forks |
| 22 | + if: github.repository == 'dask/dask-gateway' |
| 23 | + runs-on: ubuntu-latest |
| 24 | + |
| 25 | + strategy: |
| 26 | + fail-fast: false |
| 27 | + matrix: |
| 28 | + include: |
| 29 | + - image: dask-gateway |
| 30 | + - image: dask-gateway-server |
| 31 | + |
| 32 | + steps: |
| 33 | + - uses: actions/checkout@v3 |
| 34 | + |
| 35 | + - name: Refreeze Dockerfile.requirements.txt based on Dockerfile.requirements.in |
| 36 | + run: | |
| 37 | + cd ${{ matrix.image }} |
| 38 | + docker run --rm \ |
| 39 | + --env=CUSTOM_COMPILE_COMMAND='Use "Run workflow" button at https://github.com/dask/dask-gateway/actions/workflows/refreeze-dockerfile-requirements-txt.yaml' \ |
| 40 | + --volume=$PWD:/opt/${{ matrix.image }} \ |
| 41 | + --workdir=/opt/${{ matrix.image }} \ |
| 42 | + --user=root \ |
| 43 | + python:3.10-slim-bullseye \ |
| 44 | + sh -c 'pip install pip-tools==6.* && pip-compile --upgrade --output-file=Dockerfile.requirements.txt Dockerfile.requirements.in' |
| 45 | +
|
| 46 | + - name: git diff |
| 47 | + run: git --no-pager diff --color=always |
| 48 | + |
| 49 | + # ref: https://github.com/peter-evans/create-pull-request |
| 50 | + - name: Create a PR |
| 51 | + uses: peter-evans/create-pull-request@v4 |
| 52 | + with: |
| 53 | + token: "${{ secrets.dask_bot_token }}" |
| 54 | + author: Dask Bot Account <65357765+dask-bot@users.noreply.github.com> |
| 55 | + committer: Dask Bot Account <65357765+dask-bot@users.noreply.github.com> |
| 56 | + branch: update-image-${{ matrix.image }} |
| 57 | + labels: dependencies |
| 58 | + commit-message: Refreeze ${{ matrix.image}}/Dockerfile.requirements.txt |
| 59 | + title: Refreeze ${{ matrix.image}}/Dockerfile.requirements.txt |
| 60 | + body: >- |
| 61 | + ${{ matrix.image}}/Dockerfile.requirements.txt has been refrozen |
| 62 | + based on ${{ matrix.image}}/Dockerfile.requirements.in. |
0 commit comments