Skip to content

Commit 4c7b473

Browse files
committed
Tagging docker images
Signed-off-by: Piotr Karpala <[email protected]>
1 parent 495fcfc commit 4c7b473

File tree

5 files changed

+127
-61
lines changed

5 files changed

+127
-61
lines changed

.github/workflows/deploy_proxy_to_ghcr.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

.github/workflows/deploy_to_ghcr.yml

Lines changed: 62 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,68 @@ jobs:
2525
username: ${{ github.actor }}
2626
password: ${{ secrets.GITHUB_TOKEN }}
2727

28-
- name: Build and Push Docker Image
29-
run: |
30-
GITHUB_REPO="${GITHUB_REPO,,}" # convert repo name to lowercase as required by docker
31-
echo "building docker image in repository '$GITHUB_REPO' ..."
32-
docker build --label "org.opencontainers.image.title=copilot-metrics-viewer" --label "org.opencontainers.image.description=Metrics viewer for GitHub Copilot usage" --label "org.opencontainers.image.source=$GITHUB_REPO" -t ghcr.io/$GITHUB_REPO:latest .
33-
docker push ghcr.io/$GITHUB_REPO:latest
34-
env:
35-
GITHUB_REPO: ${{ github.repository }}
28+
- name: Extract metadata
29+
id: meta
30+
uses: docker/metadata-action@v4
31+
with:
32+
images: ghcr.io/${{ github.repository }}
33+
labels: |
34+
org.opencontainers.image.title=copilot-metrics-viewer-with-proxy
35+
org.opencontainers.image.description=Metrics viewer for GitHub Copilot usage
36+
org.opencontainers.image.source=${{ github.repository }}
37+
tags: |
38+
type=sha
39+
type=ref,event=branch
40+
type=ref,event=pr
41+
type=semver,pattern={{version}}
42+
type=semver,pattern={{major}}.{{minor}}
43+
44+
- name: Build and push
45+
uses: docker/build-push-action@v5
46+
with:
47+
context: .
48+
tags: ${{ steps.meta.outputs.tags }}
49+
annotations: ${{ steps.meta.outputs.annotations }}
50+
labels: ${{ steps.meta.outputs.labels }}
51+
push: true
52+
53+
push_proxy_to_ghcr:
54+
runs-on: ubuntu-latest
55+
steps:
56+
- name: Checkout GitHub Action
57+
uses: actions/checkout@v4
58+
59+
- name: Login to GitHub Container Registry
60+
uses: docker/login-action@v3
61+
with:
62+
registry: ghcr.io
63+
username: ${{ github.actor }}
64+
password: ${{ secrets.GITHUB_TOKEN }}
65+
66+
- name: Extract metadata
67+
id: meta
68+
uses: docker/metadata-action@v4
69+
with:
70+
images: ghcr.io/${{ github.repository }}-with-proxy
71+
labels: |
72+
org.opencontainers.image.title=copilot-metrics-viewer
73+
org.opencontainers.image.description=Metrics viewer for GitHub Copilot usage
74+
org.opencontainers.image.source=${{ github.repository }}
75+
tags: |
76+
type=sha
77+
type=ref,event=branch
78+
type=ref,event=pr
79+
type=semver,pattern={{version}}
80+
type=semver,pattern={{major}}.{{minor}}
81+
82+
- name: Build and push
83+
uses: docker/build-push-action@v5
84+
with:
85+
context: .
86+
tags: ${{ steps.meta.outputs.tags }}
87+
annotations: ${{ steps.meta.outputs.annotations }}
88+
labels: ${{ steps.meta.outputs.labels }}
89+
push: true
3690

3791
deploy:
3892
runs-on: ubuntu-latest

.github/workflows/deploy_to_ghcr_custom_tag.yaml

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,28 @@ jobs:
3030
username: ${{ github.actor }}
3131
password: ${{ secrets.GITHUB_TOKEN }}
3232

33-
- name: Build and Push Docker Image
34-
run: |
35-
GITHUB_REPO="${GITHUB_REPO,,}" # convert repo name to lowercase as required by docker
36-
TAG=${{ github.event.inputs.tag }}
37-
echo "building docker image in repository '$GITHUB_REPO' with tag '$TAG' ..."
38-
docker build --label "org.opencontainers.image.title=copilot-metrics-viewer" --label "org.opencontainers.image.description=Metrics viewer for GitHub Copilot usage" --label "org.opencontainers.image.source=$GITHUB_REPO" -t ghcr.io/$GITHUB_REPO:$TAG .
39-
docker push ghcr.io/$GITHUB_REPO:$TAG
40-
env:
41-
GITHUB_REPO: ${{ github.repository }}
33+
- name: Extract metadata
34+
id: meta
35+
uses: docker/metadata-action@v4
36+
with:
37+
images: ghcr.io/${{ github.repository }}
38+
labels: |
39+
org.opencontainers.image.title=copilot-metrics-viewer
40+
org.opencontainers.image.description=Metrics viewer for GitHub Copilot usage
41+
org.opencontainers.image.source=${{ github.repository }}
42+
tags: |
43+
type=raw,enable=true,priority=1,value=${{ github.event.inputs.tag }}
44+
type=sha
45+
type=ref,event=branch
46+
type=ref,event=pr
47+
type=semver,pattern={{version}}
48+
type=semver,pattern={{major}}.{{minor}}
49+
50+
- name: Build and push
51+
uses: docker/build-push-action@v5
52+
with:
53+
context: .
54+
tags: ${{ steps.meta.outputs.tags }}
55+
annotations: ${{ steps.meta.outputs.annotations }}
56+
labels: ${{ steps.meta.outputs.labels }}
57+
push: true

.github/workflows/deploy_to_ghcr_tag_release.yaml

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,29 @@ jobs:
3737
username: ${{ github.actor }}
3838
password: ${{ secrets.GITHUB_TOKEN }}
3939

40-
- name: Build and Push Docker Image
41-
run: |
42-
GITHUB_REPO="${GITHUB_REPO,,}" # convert repo name to lowercase as required by docker
43-
TAG=${{ steps.get_latest_release.outputs.result }}
44-
echo "building docker image in repository '$GITHUB_REPO' with tag '$TAG' ..."
45-
docker build --label "org.opencontainers.image.title=copilot-metrics-viewer" --label "org.opencontainers.image.description=Metrics viewer for GitHub Copilot usage" --label "org.opencontainers.image.source=$GITHUB_REPO" -t ghcr.io/$GITHUB_REPO:$TAG .
46-
docker push ghcr.io/$GITHUB_REPO:$TAG
47-
env:
48-
GITHUB_REPO: ${{ github.repository }}
40+
- name: Extract metadata
41+
id: meta
42+
uses: docker/metadata-action@v4
43+
with:
44+
images: ghcr.io/${{ github.repository }}
45+
labels: |
46+
org.opencontainers.image.title=copilot-metrics-viewer
47+
org.opencontainers.image.description=Metrics viewer for GitHub Copilot usage
48+
org.opencontainers.image.source=${{ github.repository }}
49+
tags: |
50+
type=raw,enable=true,priority=1,value=${{ steps.get_latest_release.outputs.result }}
51+
type=sha
52+
type=ref,event=branch
53+
type=ref,event=pr
54+
type=semver,pattern={{version}}
55+
type=semver,pattern={{major}}.{{minor}}
56+
57+
- name: Build and push
58+
uses: docker/build-push-action@v6
59+
with:
60+
context: .
61+
tags: ${{ steps.meta.outputs.tags }}
62+
annotations: ${{ steps.meta.outputs.annotations }}
63+
labels: ${{ steps.meta.outputs.labels }}
64+
push: true
65+

.github/workflows/playwright.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,20 @@ on:
55
pull_request:
66
branches: [ main, master ]
77
jobs:
8+
test-docker:
9+
timeout-minutes: 15
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Set up Docker Buildx
14+
uses: docker/setup-buildx-action@v3
15+
- name: Build and export to Docker
16+
uses: docker/build-push-action@v6
17+
with:
18+
file: Dockerfile
19+
load: true
20+
tags: ui:test
21+
822
test:
923
timeout-minutes: 10
1024
permissions:

0 commit comments

Comments
 (0)