@@ -3,16 +3,16 @@ name: "Build dev container"
33on :
44 push :
55 branches :
6- - master
6+ - main
77 - develop
88
99concurrency :
1010 group : ${{ github.workflow }}-${{ github.ref }}
1111 cancel-in-progress : true
1212
1313env :
14- DOCKER_USERNAME : ${{ secrets.DOCKERHUB_USERNAME }}
15- DOCKER_PASSWORD : ${{ secrets.DOCKER_PASSWORD }}
14+ REGISTRY : ghcr.io
15+ IMAGE_NAME : ${{ github.repository }}
1616
1717jobs :
1818 list-dir :
@@ -50,35 +50,25 @@ jobs:
5050 with :
5151 use : true
5252
53- # - name: Login to GitHub Container Registry
54- # uses: docker/login-action@v2
55- # with:
56- # registry: ghcr.io
57- # username: ${{ github.repository_owner }}
58- # password: ${{ secrets.GITHUB_TOKEN }}
59-
60- - name : Login to Docker registry
53+ - name : Log in to the Container registry
61546255 with :
63- username : ${{ env.DOCKER_USERNAME }}
64- password : ${{ env.DOCKER_PASSWORD }}
56+ registry : ${{ env.REGISTRY }}
57+ username : ${{ github.actor }}
58+ password : ${{ secrets.GITHUB_TOKEN }}
59+
60+ - name : Extract metadata (tags, labels) for Docker
61+ id : meta
62+ uses : docker/metadata-action@v5
63+ with :
64+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
6565
6666 - name : Build and run Dev Container task
6767 uses :
devcontainers/[email protected] 6868 with :
6969 subFolder : ./templates/${{ matrix.dir }}
70- imageName : npv2k1/ codespace
71- cacheFrom : npv2k1/ codespace: ${{ matrix.dir }}-${{ github.ref == 'refs/heads/master' && ' latest' || github.ref_name }}
72- imageTag : ${{ matrix.dir }}-${{ github.ref == 'refs/heads/master ' && 'latest' || github.ref_name }}
73- platform : linux/amd64,linux/arm64
70+ imageName : ghcr.io/pnstack/ codespace/${{ matrix.dir }}
71+ cacheFrom : ghcr.io/pnstack/ codespace/ ${{ matrix.dir }}: latest
72+ imageTag : ${{ github.ref == 'refs/heads/main ' && 'latest' || steps.meta.outputs.tags }}
73+ platform : linux/amd64 # ,linux/arm64
7474 push : always
75-
76- # - name: Build and run Dev Container task
77- # uses: devcontainers/[email protected] 78- # with:
79- # subFolder: ./templates/${{ matrix.dir }}
80- # imageName: ghcr.io/pnstack/codespace/${{ matrix.dir }}
81- # cacheFrom: ghcr.io/pnstack/codespace/${{ matrix.dir }}:latest
82- # imageTag: ${{ github.ref == 'refs/heads/master' && 'latest' || github.ref_name }}
83- # platform: linux/amd64,linux/arm64
84- # # push: always
0 commit comments