Skip to content

Commit ce38cd0

Browse files
authored
Create publish-container-image-icr.yml
1 parent 34e140e commit ce38cd0

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Publish container image
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish_to_registry:
9+
name: Build and push image to registry
10+
runs-on: ubuntu-latest
11+
env:
12+
ICR_NAMESPACE: solution-tutorials
13+
ICR_REPOSITORY: tutorial-application-log-analysis
14+
steps:
15+
- name: Check out the repo
16+
uses: actions/checkout@v2
17+
18+
- name: Log in to Container Registry
19+
uses: docker/login-action@v1.10.0
20+
with:
21+
registry: icr.io
22+
username: ${{ secrets.ICR_USER }}
23+
password: ${{ secrets.ICR_TOKEN }}
24+
25+
- name: Extract metadata (tags, labels) for Docker
26+
id: meta
27+
uses: docker/metadata-action@v3.6.2
28+
with:
29+
images: icr.io/${{ env.ICR_NAMESPACE }}/${{ env.ICR_REPOSITORY }}
30+
31+
- name: Build and push image
32+
uses: docker/build-push-action@v2.8.0
33+
with:
34+
context: .
35+
push: true
36+
tags: ${{ steps.meta.outputs.tags }}
37+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)