-
Notifications
You must be signed in to change notification settings - Fork 19
49 lines (49 loc) · 1.36 KB
/
publish-docker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Weaver Docker Generator
on:
push:
tags: [ '**' ]
branches:
- main
pull_request:
branches:
- main
paths:
- .github/workflows/publish-docker.yml
- 'src/**'
- 'crates/**'
env:
TEST_WEAVER_TAG: otel/weaver:test
jobs:
make-docker-image:
name: Docker Image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/[email protected]
with:
images: otel/weaver
- name: Build test image
uses: docker/[email protected]
with:
push: false
load: true
tags: ${{ env.TEST_WEAVER_TAG }}
labels: ${{ steps.meta.outputs.labels }}
- name: Test
run: |
docker run --rm ${{ env.TEST_WEAVER_TAG }} --help
- name: Log in to Docker Hub
uses: docker/[email protected]
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
uses: docker/[email protected]
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}