1
+ name : perfSONAR Lookup Server Image
2
+
3
+ # This action builds Docker images then
4
+ # pushes result to GitHub Container Registry.
5
+
6
+ on :
7
+ push :
8
+ branches : [ '*' ]
9
+ # Publish semver tags as releases.
10
+ tags : [ 'v*.*.*' ]
11
+ pull_request :
12
+ branches : [ 'main' ]
13
+
14
+ env :
15
+ REGISTRY : ghcr.io
16
+ # github.repository as <account>/<repo>
17
+ IMAGE_BASE : ${{ github.repository }}
18
+ BUILD_DIR : .
19
+
20
+ jobs :
21
+ build :
22
+ runs-on : ubuntu-latest
23
+ permissions :
24
+ contents : read
25
+ packages : write
26
+ # This is used to complete the identity challenge
27
+ # with sigstore/fulcio when running outside of PRs.
28
+ id-token : write
29
+
30
+ steps :
31
+ - name : Checkout repository
32
+ uses : actions/checkout@v3
33
+
34
+ - name : Set up QEMU
35
+ uses : docker/setup-qemu-action@v2
36
+
37
+ - name : Setup Docker buildx
38
+ uses : docker/setup-buildx-action@v2
39
+
40
+ # Login against a Docker registry except on PR
41
+ # https://github.com/docker/login-action
42
+ - name : Log into registry ${{ env.REGISTRY }}
43
+ if : github.event_name != 'pull_request'
44
+ uses : docker/login-action@v2
45
+ with :
46
+ registry : ${{ env.REGISTRY }}
47
+ username : ${{ github.actor }}
48
+ password : ${{ secrets.GITHUB_TOKEN }}
49
+
50
+ # Extract metadata (tags, labels) for Docker
51
+ # https://github.com/docker/metadata-action
52
+ - name : Extract Docker metadata
53
+ id : meta
54
+ uses : docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
55
+ with :
56
+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_BASE }}
57
+ tags : |
58
+ type=schedule
59
+ type=ref,event=branch
60
+ type=ref,event=tag
61
+ type=ref,event=pr
62
+ type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
63
+
64
+ # Build and push Docker image with Buildx (don't push on PR)
65
+ # https://github.com/docker/build-push-action
66
+ - name : Build and push Docker images
67
+ id : build-and-push
68
+ uses : docker/build-push-action@v3
69
+ with :
70
+ context : ${{ env.BUILD_DIR }}
71
+ file : ${{ env.BUILD_DIR }}/Dockerfile
72
+ push : ${{ github.event_name != 'pull_request' }}
73
+ tags : ${{ steps.meta.outputs.tags }}
74
+ labels : ${{ steps.meta.outputs.labels }}
0 commit comments