|
57 | 57 | - name: publish to pypi
|
58 | 58 | uses: pypa/gh-action-pypi-publish@release/v1
|
59 | 59 | if: startsWith(github.ref, 'refs/tags/')
|
| 60 | + |
| 61 | + publish-images: |
| 62 | + runs-on: ubuntu-22.04 |
| 63 | + |
| 64 | + strategy: |
| 65 | + fail-fast: false |
| 66 | + matrix: |
| 67 | + include: |
| 68 | + - vncserver: tigervnc |
| 69 | + - vncserver: turbovnc |
| 70 | + |
| 71 | + steps: |
| 72 | + - uses: actions/checkout@v4 |
| 73 | + |
| 74 | + - name: Set up QEMU (for docker buildx) |
| 75 | + uses: docker/setup-qemu-action@v3 |
| 76 | + |
| 77 | + - name: Set up Docker Buildx (for multi-arch builds) |
| 78 | + uses: docker/setup-buildx-action@v3 |
| 79 | + |
| 80 | + - name: Make decisions on pushing and suffix (based on vnc server chosen) |
| 81 | + id: decisions |
| 82 | + run: | |
| 83 | + if [ "${{ startsWith(github.ref, 'refs/tags/') || (github.ref == 'refs/heads/main') }}" = "true" ]; then |
| 84 | + echo "push=true" >> $GITHUB_OUTPUT |
| 85 | + else |
| 86 | + echo "push=false" >> $GITHUB_OUTPUT |
| 87 | + fi |
| 88 | +
|
| 89 | + # We provide image tags with -tigervnc and -turbovnc suffixes to allow |
| 90 | + # for an explicit choice, but also ship with a default choice of |
| 91 | + # TigerVNC. |
| 92 | + if [ "${{ matrix.vncserver == 'tigervnc' }}" == "true" ]; then |
| 93 | + echo "suffix=<empty-string>,-${{ matrix.vncserver }}" >> $GITHUB_OUTPUT |
| 94 | + else |
| 95 | + echo "suffix=-${{ matrix.vncserver }}" >> $GITHUB_OUTPUT |
| 96 | + fi |
| 97 | +
|
| 98 | + # For builds triggered by a git tag 1.2.3, we calculate image tags like: |
| 99 | + # [{prefix}:1.2.3, {prefix}:1.2, {prefix}:1, {prefix}:latest] |
| 100 | + # |
| 101 | + # More details at |
| 102 | + # https://github.com/jupyterhub/action-major-minor-tag-calculator. |
| 103 | + # |
| 104 | + - name: Get image tags |
| 105 | + id: tags |
| 106 | + uses: jupyterhub/action-major-minor-tag-calculator@v3 |
| 107 | + with: |
| 108 | + githubToken: ${{ secrets.GITHUB_TOKEN }} |
| 109 | + prefix: "quay.io/jupyterhub/jupyter-remote-desktop-proxy:" |
| 110 | + suffix: ${{ steps.decisions.outputs.suffix }} |
| 111 | + branchRegex: ^\w[\w-.]*$ |
| 112 | + defaultTag: quay.io/jupyterhub/jupyter-remote-desktop-proxy:noref |
| 113 | + |
| 114 | + - name: Login to container registry |
| 115 | + # Credentials to Quay.io was setup by... |
| 116 | + # 1. Creating a [Robot Account](https://quay.io/organization/jupyterhub?tab=robots) |
| 117 | + # 2. Giving it push permissions to the image repository |
| 118 | + # 3. Adding Robot Account credentials as workflow environment secrets |
| 119 | + if: steps.decisions.outputs.push == 'true' |
| 120 | + run: | |
| 121 | + docker login -u "${{ secrets.QUAY_USERNAME }}" -p "${{ secrets.QUAY_PASSWORD }}" quay.io |
| 122 | +
|
| 123 | + - name: Build and push image |
| 124 | + uses: docker/build-push-action@v5 |
| 125 | + with: |
| 126 | + build-args: | |
| 127 | + vncserver=${{ matrix.vncserver }} |
| 128 | + context: . |
| 129 | + platforms: linux/amd64,linux/arm64 |
| 130 | + push: ${{ steps.decisions.outputs.push }} |
| 131 | + tags: ${{ join(fromJson(steps.tags.outputs.tags)) }} |
0 commit comments