diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e0443e9120..3d7bba0c7d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,6 +4,9 @@ on: push: branches: - "main" + create: + tags: + - "v*" workflow_dispatch: jobs: @@ -45,6 +48,9 @@ jobs: images: | winglian/axolotl axolotlai/axolotl + tags: | + type=ref,event=tag + type=ref,event=push - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to Docker Hub @@ -58,7 +64,7 @@ jobs: with: context: . build-args: | - BASE_TAG=${{ github.ref_name }}-base-py${{ matrix.python_version }}-cu${{ matrix.cuda }}-${{ matrix.pytorch }} + BASE_TAG=${{ github.ref_type == 'tag' && 'main' || github.ref_name }}-base-py${{ matrix.python_version }}-cu${{ matrix.cuda }}-${{ matrix.pytorch }} CUDA=${{ matrix.cuda }} PYTORCH_VERSION=${{ matrix.pytorch }} AXOLOTL_ARGS=${{ matrix.axolotl_args }} @@ -121,7 +127,7 @@ jobs: with: context: . build-args: | - BASE_TAG=${{ github.ref_name }}-py${{ matrix.python_version }}-cu${{ matrix.cuda }}-${{ matrix.pytorch }}${{ matrix.axolotl_extras != '' && '-' || '' }}${{ matrix.axolotl_extras }} + BASE_TAG=${{ github.ref_type == 'tag' && 'main' || github.ref_name }}-py${{ matrix.python_version }}-cu${{ matrix.cuda }}-${{ matrix.pytorch }}${{ matrix.axolotl_extras != '' && '-' || '' }}${{ matrix.axolotl_extras }} CUDA=${{ matrix.cuda }} file: ./docker/Dockerfile-cloud push: ${{ github.event_name != 'pull_request' }} @@ -153,6 +159,9 @@ jobs: images: | winglian/axolotl-cloud-term axolotlai/axolotl-cloud-term + tags: | + type=ref,event=tag + type=ref,event=push - name: Login to Docker Hub uses: docker/login-action@v3 with: @@ -165,7 +174,7 @@ jobs: with: context: . build-args: | - BASE_TAG=${{ github.ref_name }}-py${{ matrix.python_version }}-cu${{ matrix.cuda }}-${{ matrix.pytorch }}${{ matrix.axolotl_extras != '' && '-' || '' }}${{ matrix.axolotl_extras }} + BASE_TAG=${{ github.ref_type == 'tag' && 'main' || github.ref_name }}-py${{ matrix.python_version }}-cu${{ matrix.cuda }}-${{ matrix.pytorch }}${{ matrix.axolotl_extras != '' && '-' || '' }}${{ matrix.axolotl_extras }} CUDA=${{ matrix.cuda }} file: ./docker/Dockerfile-cloud-no-tmux push: ${{ github.event_name != 'pull_request' }}