Docker Image CI #39
This file contains 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 Image CI | |
on: | |
workflow_dispatch: | |
jobs: | |
Build: | |
strategy: | |
matrix: | |
WORKLOAD: | |
- vctools | |
- xamarinbuildtools | |
- nodebuildtools | |
- officebuildtools | |
- universalbuildtools | |
- webbuildtools | |
- netcorebuildtools | |
- manageddesktopbuildtools | |
- azurebuildtools | |
- databuildtools | |
VS_VER: | |
- 2022 | |
- 2019 | |
- 2017 | |
WIN_VER: | |
- 2022 | |
- 2019 | |
runs-on: windows-${{ matrix.WIN_VER }} | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Pull and tag parent image | |
run: | | |
docker pull ghcr.io/${{ github.repository_owner }}/visualstudio${{ matrix.VS_VER }}buildtools:ltsc${{ matrix.WIN_VER }} | |
docker tag ghcr.io/${{ github.repository_owner }}/visualstudio${{ matrix.VS_VER }}buildtools:ltsc${{ matrix.WIN_VER }} ${{ secrets.DOCKERHUB_USERNAME }}/visualstudio${{ matrix.VS_VER }}buildtools:ltsc${{ matrix.WIN_VER }} | |
- name: Build | |
run: > | |
docker build | |
--build-arg WIN_VER=ltsc${{ matrix.WIN_VER }} | |
--build-arg VS_VER=${{ matrix.VS_VER }} | |
--build-arg WORKLOAD=${{ matrix.WORKLOAD }} | |
-t ${{ secrets.DOCKERHUB_USERNAME }}/visualstudio${{ matrix.VS_VER }}-workload-${{ matrix.WORKLOAD }}:ltsc${{ matrix.WIN_VER }} | |
-t ghcr.io/${{ github.repository_owner }}/visualstudio${{ matrix.VS_VER }}-workload-${{ matrix.WORKLOAD }}:ltsc${{ matrix.WIN_VER }} | |
. | |
- name: Tag latest | |
if: ${{ matrix.WIN_VER == 2022 }} | |
run: | | |
docker tag ${{ secrets.DOCKERHUB_USERNAME }}/visualstudio${{ matrix.VS_VER }}-workload-${{ matrix.WORKLOAD }}:ltsc${{ matrix.WIN_VER }} ${{ secrets.DOCKERHUB_USERNAME }}/visualstudio${{ matrix.VS_VER }}-workload-${{ matrix.WORKLOAD }} | |
docker tag ghcr.io/${{ github.repository_owner }}/visualstudio${{ matrix.VS_VER }}-workload-${{ matrix.WORKLOAD }}:ltsc${{ matrix.WIN_VER }} ghcr.io/${{ github.repository_owner }}/visualstudio${{ matrix.VS_VER }}-workload-${{ matrix.WORKLOAD }} | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to GHCR | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: push | |
run: | | |
docker push ${{ secrets.DOCKERHUB_USERNAME }}/visualstudio${{ matrix.VS_VER }}-workload-${{ matrix.WORKLOAD }} --all-tags | |
docker push ghcr.io/${{ github.repository_owner }}/visualstudio${{ matrix.VS_VER }}-workload-${{ matrix.WORKLOAD }} --all-tags |