Skip to content

Commit

Permalink
Improve tagging (#101)
Browse files Browse the repository at this point in the history
* Improve tagging so that containers are not just latest

* Remove conditions around PR

* Rename job

* Add GHCR prefix

* Switch to official docker metadata action

* Rename and reindent, stupid yaml

* Make it use GHCR rather than DockerHub

* Remove format owner
  • Loading branch information
the-frey authored Nov 29, 2021
1 parent bc96dd9 commit 7f555bf
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,45 @@
name: ci

on:
pull_request:
push:
branches:
- 'main'

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
- name: Checkout
uses: actions/checkout@v2
-
name: Set up QEMU
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to GitHub Container Registry
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: formatowner
uses: ASzc/change-string-case-action@v1
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
string: ${{ github.repository_owner }}
-
name: Build and push
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64
push: true
tags: |
ghcr.io/${{ steps.formatowner.outputs.lowercase }}/juno:latest
tags: ${{ steps.meta.outputs.tags }}

0 comments on commit 7f555bf

Please sign in to comment.