I have used github actions for CI.
I got an error in build and push: Error: buildx failed with: error: invalid tag "docker.pkg.github.com/myself/cmms:": invalid reference format
main.yml
name: ci
on:
workflow_dispatch:
push:
tags:
- "v*.*"
env:
IMAGE_NAME: CMMS
jobs:
get-tags:
runs-on: ubuntu-20.04
env:
TZ: Asia/Shanghai
outputs:
tags: ${{ steps.set-output-id.outputs.tags }}
steps:
- uses: actions/checkout@v2
- name: set-output
id: set-output-id
run: |
VERSION=edge
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
fi
echo ::set-output name=tags::${VERSION}
push-ghcr:
runs-on: ubuntu-20.04
env:
TZ: Asia/Shanghai
REGISTRY: docker.pkg.github.com
steps:
- uses: actions/checkout@v2
- name: Login
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.PACKAGES_TOKEN }}
- name: Build && Push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: |
${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ needs.get-tags.outputs.tags }}
${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest
dockerfile:
FROM python:3.7
ENV PYTHONUNBUFFERED 1
RUN apt-get update
RUN mkdir /code
WORKDIR /code
ADD requirements.txt /code/
RUN pip install -r requirements.txt
ADD . /code/
EXPOSE 8000
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
How could I fix this error? The yaml file was copied from some technical blog, which should work well.