Skip to content

Commit 8dbb5e0

Browse files
committed
fixes to tagging
1 parent 8f20cda commit 8dbb5e0

File tree

3 files changed

+18
-43
lines changed

3 files changed

+18
-43
lines changed

.github/workflows/deploy_to_ghcr.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,19 @@ jobs:
2525
username: ${{ github.actor }}
2626
password: ${{ secrets.GITHUB_TOKEN }}
2727

28+
# Adding below tag any push to main as "latest"
29+
# To deploy latest, create a release with a semver tag
30+
# type=raw,value=latest,enable={{is_default_branch}}
2831
- name: Extract metadata
2932
id: meta
30-
uses: docker/metadata-action@v4
33+
uses: docker/metadata-action@v5
3134
with:
3235
images: ghcr.io/${{ github.repository }}
3336
labels: |
3437
org.opencontainers.image.title=copilot-metrics-viewer
3538
org.opencontainers.image.description=Metrics viewer for GitHub Copilot usage
3639
org.opencontainers.image.source=${{ github.repository }}
3740
tags: |
38-
type=raw,value=latest,enable={{is_default_branch}}
3941
type=sha
4042
type=ref,event=branch
4143
type=ref,event=pr
@@ -47,7 +49,6 @@ jobs:
4749
with:
4850
context: .
4951
tags: ${{ steps.meta.outputs.tags }}
50-
annotations: ${{ steps.meta.outputs.annotations }}
5152
labels: ${{ steps.meta.outputs.labels }}
5253
push: true
5354

@@ -64,17 +65,19 @@ jobs:
6465
username: ${{ github.actor }}
6566
password: ${{ secrets.GITHUB_TOKEN }}
6667

68+
# Adding below tag any push to main as "latest"
69+
# To deploy latest, create a release with a semver tag
70+
# type=raw,value=latest,enable={{is_default_branch}}
6771
- name: Extract metadata
6872
id: meta
69-
uses: docker/metadata-action@v4
73+
uses: docker/metadata-action@v5
7074
with:
7175
images: ghcr.io/${{ github.repository }}-with-proxy
7276
labels: |
7377
org.opencontainers.image.title=copilot-metrics-viewer-with-proxy
7478
org.opencontainers.image.description=Metrics viewer for GitHub Copilot usage
7579
org.opencontainers.image.source=${{ github.repository }}
7680
tags: |
77-
type=raw,value=latest,enable={{is_default_branch}}
7881
type=sha
7982
type=ref,event=branch
8083
type=ref,event=pr
@@ -87,7 +90,6 @@ jobs:
8790
context: .
8891
file: api.Dockerfile
8992
tags: ${{ steps.meta.outputs.tags }}
90-
annotations: ${{ steps.meta.outputs.annotations }}
9193
labels: ${{ steps.meta.outputs.labels }}
9294
push: true
9395

@@ -106,4 +108,4 @@ jobs:
106108
app-name: 'copilot-metrics-viewer'
107109
slot-name: 'production'
108110
publish-profile: ${{ secrets.AzureAppService_PublishProfile_e94dfd38811a421eafe5ce4eee13b68b }}
109-
images: 'ghcr.io/github-copilot-resources/copilot-metrics-viewer:latest'
111+
images: 'ghcr.io/github-copilot-resources/copilot-metrics-viewer:main'

.github/workflows/deploy_to_ghcr_custom_tag.yaml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
name: Build and push Docker image with custom tag
2+
# NOTE: this pipeline is not needed as images are pushed after release
23

34
on:
45
workflow_dispatch:
56
inputs:
67
tag:
7-
description: 'Tag for the Docker image'
8+
description: 'git tag to be used as tag for the Docker image e.g. "custom-tag"'
89
required: true
9-
default: 'latest'
10+
default: 'my-tag'
1011

1112
permissions:
1213
packages: write
@@ -19,7 +20,7 @@ jobs:
1920
uses: actions/checkout@v4
2021
with:
2122
fetch-depth: 0 # Fetch all history for all tags and branches
22-
ref: v${{ github.event.inputs.tag }}
23+
ref: ${{ github.event.inputs.tag }}
2324

2425
- name: Login to GitHub Container Registry
2526
uses: docker/login-action@v3
@@ -30,7 +31,7 @@ jobs:
3031

3132
- name: Extract metadata
3233
id: meta
33-
uses: docker/metadata-action@v4
34+
uses: docker/metadata-action@v5
3435
with:
3536
images: ghcr.io/${{ github.repository }}
3637
labels: |
@@ -50,7 +51,6 @@ jobs:
5051
with:
5152
context: .
5253
tags: ${{ steps.meta.outputs.tags }}
53-
annotations: ${{ steps.meta.outputs.annotations }}
5454
labels: ${{ steps.meta.outputs.labels }}
5555
push: true
5656

@@ -61,7 +61,7 @@ jobs:
6161
uses: actions/checkout@v4
6262
with:
6363
fetch-depth: 0 # Fetch all history for all tags and branches
64-
ref: v${{ github.event.inputs.tag }}
64+
ref: ${{ github.event.inputs.tag }}
6565

6666

6767
- name: Login to GitHub Container Registry
@@ -73,7 +73,7 @@ jobs:
7373

7474
- name: Extract metadata
7575
id: meta
76-
uses: docker/metadata-action@v4
76+
uses: docker/metadata-action@v5
7777
with:
7878
images: ghcr.io/${{ github.repository }}-with-proxy
7979
labels: |
@@ -94,7 +94,6 @@ jobs:
9494
context: .
9595
file: api.Dockerfile
9696
tags: ${{ steps.meta.outputs.tags }}
97-
annotations: ${{ steps.meta.outputs.annotations }}
9897
labels: ${{ steps.meta.outputs.labels }}
9998
push: true
10099

.github/workflows/deploy_to_ghcr_tag_release.yaml

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,6 @@ jobs:
1919
- name: Checkout GitHub Action
2020
uses: actions/checkout@v4
2121

22-
- name: Get Latest Release Tag
23-
id: get_latest_release
24-
uses: actions/github-script@v6
25-
with:
26-
script: |
27-
const latestRelease = await github.rest.repos.getLatestRelease({
28-
owner: context.repo.owner,
29-
repo: context.repo.repo,
30-
});
31-
core.setOutput('tag_name', latestRelease.data.tag_name);
32-
3322
- name: Login to GitHub Container Registry
3423
uses: docker/login-action@v3
3524
with:
@@ -39,15 +28,14 @@ jobs:
3928

4029
- name: Extract metadata
4130
id: meta
42-
uses: docker/metadata-action@v4
31+
uses: docker/metadata-action@v5
4332
with:
4433
images: ghcr.io/${{ github.repository }}
4534
labels: |
4635
org.opencontainers.image.title=copilot-metrics-viewer
4736
org.opencontainers.image.description=Metrics viewer for GitHub Copilot usage
4837
org.opencontainers.image.source=${{ github.repository }}
4938
tags: |
50-
type=raw,enable=true,priority=1,value=${{ steps.get_latest_release.outputs.result }}
5139
type=sha
5240
type=ref,event=branch
5341
type=ref,event=pr
@@ -59,7 +47,6 @@ jobs:
5947
with:
6048
context: .
6149
tags: ${{ steps.meta.outputs.tags }}
62-
annotations: ${{ steps.meta.outputs.annotations }}
6350
labels: ${{ steps.meta.outputs.labels }}
6451
push: true
6552

@@ -75,29 +62,17 @@ jobs:
7562
registry: ghcr.io
7663
username: ${{ github.actor }}
7764
password: ${{ secrets.GITHUB_TOKEN }}
78-
79-
- name: Get Latest Release Tag
80-
id: get_latest_release
81-
uses: actions/github-script@v6
82-
with:
83-
script: |
84-
const latestRelease = await github.rest.repos.getLatestRelease({
85-
owner: context.repo.owner,
86-
repo: context.repo.repo,
87-
});
88-
core.setOutput('tag_name', latestRelease.data.tag_name);
8965

9066
- name: Extract metadata
9167
id: meta
92-
uses: docker/metadata-action@v4
68+
uses: docker/metadata-action@v5
9369
with:
9470
images: ghcr.io/${{ github.repository }}-with-proxy
9571
labels: |
9672
org.opencontainers.image.title=copilot-metrics-viewer-with-proxy
9773
org.opencontainers.image.description=Metrics viewer for GitHub Copilot usage
9874
org.opencontainers.image.source=${{ github.repository }}
9975
tags: |
100-
type=raw,enable=true,priority=1,value=${{ steps.get_latest_release.outputs.result }}
10176
type=sha
10277
type=ref,event=branch
10378
type=ref,event=pr
@@ -110,7 +85,6 @@ jobs:
11085
context: .
11186
file: api.Dockerfile
11287
tags: ${{ steps.meta.outputs.tags }}
113-
annotations: ${{ steps.meta.outputs.annotations }}
11488
labels: ${{ steps.meta.outputs.labels }}
11589
push: true
11690

0 commit comments

Comments
 (0)