|
| 1 | +name: Docker images - Push stable |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + inputs: |
| 5 | + images: |
| 6 | + description: 'Generate image' |
| 7 | + required: true |
| 8 | + default: 'all' |
| 9 | + type: choice |
| 10 | + options: |
| 11 | + - windows-latest |
| 12 | + - linux-latest |
| 13 | + - all |
| 14 | + |
| 15 | + ansyslab: |
| 16 | + description: 'Push to Ansys Lab' |
| 17 | + type: boolean |
| 18 | + |
| 19 | +concurrency: |
| 20 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 21 | + cancel-in-progress: true |
| 22 | + |
| 23 | +permissions: |
| 24 | + packages: write |
| 25 | + |
| 26 | +jobs: |
| 27 | + windows: |
| 28 | + name: Publish Windows latest image |
| 29 | + runs-on: windows-latest |
| 30 | + if: inputs.images == 'all' || inputs.images == 'windows-latest' |
| 31 | + env: |
| 32 | + WINDOWS_UNSTABLE: ghcr.io/pyansys/geometry:windows-latest-unstable |
| 33 | + WINDOWS_STABLE_GHCR: ghcr.io/pyansys/geometry:windows-latest |
| 34 | + WINDOWS_STABLE_FUJI: azwepsifujiaksacr.azurecr.io/ansys/discovery/geometry:windows-latest |
| 35 | + steps: |
| 36 | + - name: Login in Github Container registry |
| 37 | + uses: docker/login-action@v2 |
| 38 | + with: |
| 39 | + registry: ghcr.io |
| 40 | + username: ${{ github.actor }} |
| 41 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 42 | + |
| 43 | + - name: Pull Windows latest unstable container |
| 44 | + run: docker pull ${{ env.WINDOWS_UNSTABLE }} |
| 45 | + |
| 46 | + - name: Tag container as latest (stable) for Github Container registry |
| 47 | + run: docker tag ${{ env.WINDOWS_UNSTABLE }} ${{ env.WINDOWS_STABLE_GHCR }} |
| 48 | + |
| 49 | + - name: Publish latest stable container in ghcr.io |
| 50 | + run: docker push ${{ env.WINDOWS_STABLE_GHCR }} |
| 51 | + |
| 52 | + - name: Login in AnsysLab registry |
| 53 | + if: ${{ inputs.ansyslab }} |
| 54 | + uses: docker/login-action@v2 |
| 55 | + with: |
| 56 | + registry: azwepsifujiaksacr.azurecr.io |
| 57 | + username: ${{ secrets.FUJI_USER }} |
| 58 | + password: ${{ secrets.FUJI_TOKEN }} |
| 59 | + |
| 60 | + - name: Tag container as latest (stable) for AnsysLab registry |
| 61 | + if: ${{ inputs.ansyslab }} |
| 62 | + run: docker tag ${{ env.WINDOWS_UNSTABLE }} ${{ env.WINDOWS_STABLE_FUJI }} |
| 63 | + |
| 64 | + - name: Publish latest stable container in AnsysLab registry |
| 65 | + if: ${{ inputs.ansyslab }} |
| 66 | + run: docker push ${{ env.WINDOWS_STABLE_FUJI }} |
| 67 | + |
| 68 | + linux: |
| 69 | + name: Publish Linux latest image |
| 70 | + runs-on: ubuntu-latest |
| 71 | + if: inputs.images == 'all' || inputs.images == 'linux-latest' |
| 72 | + env: |
| 73 | + LINUX_UNSTABLE: ghcr.io/pyansys/geometry:linux-latest-unstable |
| 74 | + LINUX_STABLE_GHCR: ghcr.io/pyansys/geometry:linux-latest |
| 75 | + LINUX_STABLE_FUJI: azwepsifujiaksacr.azurecr.io/ansys/discovery/geometry:linux-latest |
| 76 | + steps: |
| 77 | + - name: Login in Github Container registry |
| 78 | + uses: docker/login-action@v2 |
| 79 | + with: |
| 80 | + registry: ghcr.io |
| 81 | + username: ${{ github.actor }} |
| 82 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 83 | + |
| 84 | + - name: Pull Linux latest unstable container |
| 85 | + run: docker pull ${{ env.LINUX_UNSTABLE }} |
| 86 | + |
| 87 | + - name: Tag container as latest (stable) for Github Container registry |
| 88 | + run: docker tag ${{ env.LINUX_UNSTABLE }} ${{ env.LINUX_STABLE_GHCR }} |
| 89 | + |
| 90 | + - name: Publish latest stable container in ghcr.io |
| 91 | + run: docker push ${{ env.LINUX_STABLE_GHCR }} |
| 92 | + |
| 93 | + - name: Login in AnsysLab registry |
| 94 | + if: ${{ inputs.ansyslab }} |
| 95 | + uses: docker/login-action@v2 |
| 96 | + with: |
| 97 | + registry: azwepsifujiaksacr.azurecr.io |
| 98 | + username: ${{ secrets.FUJI_USER }} |
| 99 | + password: ${{ secrets.FUJI_TOKEN }} |
| 100 | + |
| 101 | + - name: Tag container as latest (stable) for AnsysLab registry |
| 102 | + if: ${{ inputs.ansyslab }} |
| 103 | + run: docker tag ${{ env.LINUX_UNSTABLE }} ${{ env.LINUX_STABLE_FUJI }} |
| 104 | + |
| 105 | + - name: Publish latest stable container in AnsysLab registry |
| 106 | + if: ${{ inputs.ansyslab }} |
| 107 | + run: docker push ${{ env.LINUX_STABLE_FUJI }} |
0 commit comments