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

docs: example to sanitize tags with metadata-action #476

Merged
merged 1 commit into from Oct 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 20 additions & 2 deletions TROUBLESHOOTING.md
Expand Up @@ -100,15 +100,33 @@ or a cache reference:
```

To fix this issue you can use our [metadata action](https://github.com/docker/metadata-action)
to generate sanitized tags, or a dedicated step to sanitize the slug:
to generate sanitized tags:

```yaml
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: ghcr.io/${{ github.repository }}
tags: latest

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
```

Or a dedicated step to sanitize the slug:

```yaml
- name: Sanitize repo slug
uses: actions/github-script@v4
id: repo_slug
with:
result-encoding: string
script: return '${{ github.repository }}'.toLowerCase()
script: return 'ghcr.io/${{ github.repository }}'.toLowerCase()

- name: Build and push
uses: docker/build-push-action@v2
Expand Down