Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buildx failed with: error: invalid tag "***/contoso-website:${GITHUB_REF#refs/tags}": invalid reference format #7

Open
iamalexmang opened this issue Jul 11, 2021 · 2 comments

Comments

@iamalexmang
Copy link

I'm getting buildx failed with: error: invalid tag "***/contoso-website:${GITHUB_REF#refs/tags}": invalid reference format for the production builds.

@iamalexmang
Copy link
Author

image

@shakian-jh
Copy link

shakian-jh commented Jul 16, 2021

Hi @iamalexmang,
You can fix it by setting the branch and passing it with the build-args.
Please see code below.

    steps:
      - uses: actions/checkout@v2

      - name: Set BRANCH
        run: echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV      

      - name: Set up Buildx
        uses: docker/setup-buildx-action@v1
<skipped>
      - name: Build and push production image
        uses: docker/[email protected]
        with:
          context: .
          tags: ${{secrets.ACR_NAME}}/contoso-website:latest,${{secrets.ACR_NAME}}/contoso-website:${{ env.BRANCH }}
          push: true
          build-args: |
              BRANCH=${{ env.BRANCH }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants