Docker Image CI #32
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: | |
ltsc2022: | |
strategy: | |
matrix: | |
WIN_VER: ["2022", "2019"] | |
VS_VER: ["2022", "2019", "2017"] | |
runs-on: windows-${{ matrix.WIN_VER }} | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- 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: 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 }} | |
-t ${{ secrets.DOCKERHUB_USERNAME }}/visualstudio${{ matrix.VS_VER }}-workload-vctools:ltsc${{ matrix.WIN_VER }} | |
-t ghcr.io/${{ github.repository_owner }}/visualstudio${{ matrix.VS_VER }}-workload-vctools:ltsc${{ matrix.WIN_VER }} | |
. | |
- name: Tag latest | |
if: ${{matrix.WIN_VER == 2022 }} | |
run: | | |
docker tag ${{ secrets.DOCKERHUB_USERNAME }}/visualstudio${{ matrix.VS_VER }}-workload-vctools:ltsc${{ matrix.WIN_VER }} ${{ secrets.DOCKERHUB_USERNAME }}/visualstudio${{ matrix.VS_VER }}-workload-vctools | |
docker tag ghcr.io/${{ github.repository_owner }}/visualstudio${{ matrix.VS_VER }}-workload-vctools:ltsc${{ matrix.WIN_VER }} ghcr.io/visualstudio${{ matrix.VS_VER }}-workload-vctools | |
- name: push | |
run: | | |
docker push ${{ secrets.DOCKERHUB_USERNAME }}/visualstudio${{ matrix.VS_VER }}-workload-vctools --all-tags | |
docker push ghcr.io/${{ github.repository_owner }}/visualstudio${{ matrix.VS_VER }}-workload-vctools --all-tags |