|
1 | | -name: release |
| 1 | +name: Docker Image |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | 5 | tags: |
6 | 6 | - '**' |
7 | | - branches: |
8 | | - - 'develop' |
9 | 7 |
|
10 | 8 | jobs: |
| 9 | + |
11 | 10 | build: |
12 | 11 | runs-on: ubuntu-latest |
| 12 | + |
13 | 13 | steps: |
14 | | - - name: Check out repo |
15 | | - uses: actions/checkout@v2 |
16 | | - with: |
17 | | - fetch-depth: 0 |
18 | | - |
19 | | - - name: Docker meta |
20 | | - id: meta |
21 | | - uses: docker/metadata-action@v3 |
22 | | - with: |
23 | | - images: ghcr.io/${{ github.repository_owner }}/cert-manager-webhook-nicru |
24 | | - tags: | |
25 | | - type=schedule |
26 | | - type=ref,event=branch |
27 | | - type=ref,event=pr |
28 | | - type=semver,pattern={{version}} |
29 | | - type=semver,pattern={{major}}.{{minor}} |
30 | | - type=semver,pattern={{major}} |
31 | | - type=sha |
32 | | -
|
33 | | - - name: Set up Docker buildx |
34 | | - uses: docker/setup-buildx-action@v1 |
35 | | - |
36 | | - - name: Login to Github Packages |
37 | | - uses: docker/login-action@v1 |
38 | | - with: |
39 | | - registry: ghcr.io |
40 | | - username: ${{ github.repository_owner }} |
41 | | - password: ${{ secrets.GITHUB_TOKEN }} |
42 | | - |
43 | | - - name: Build and push |
44 | | - uses: docker/build-push-action@v2 |
45 | | - with: |
46 | | - context: . |
47 | | - push: true |
48 | | - tags: ${{ steps.meta.outputs.tags }} |
| 14 | + - uses: actions/checkout@v4 |
| 15 | + |
| 16 | + - name: Docker meta |
| 17 | + id: meta |
| 18 | + uses: docker/metadata-action@v5 |
| 19 | + with: |
| 20 | + images: ghcr.io/${{ github.repository }} |
| 21 | + tags: | |
| 22 | + type=schedule |
| 23 | + type=ref,event=branch |
| 24 | + type=ref,event=pr |
| 25 | + type=semver,pattern={{version}} |
| 26 | + type=semver,pattern={{major}}.{{minor}} |
| 27 | + type=semver,pattern={{major}} |
| 28 | + type=sha |
| 29 | +
|
| 30 | + - name: Set up Docker Buildx |
| 31 | + id: buildx |
| 32 | + uses: docker/setup-buildx-action@v3 |
| 33 | + |
| 34 | + - name: Login to Github Packages |
| 35 | + uses: docker/login-action@v3 |
| 36 | + with: |
| 37 | + registry: ghcr.io |
| 38 | + username: ${{ github.repository_owner }} |
| 39 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 40 | + |
| 41 | + - name: Build and push |
| 42 | + uses: docker/build-push-action@v5 |
| 43 | + with: |
| 44 | + context: . |
| 45 | + build-args: | |
| 46 | + versionflags=-X 'main.appVersion=${{ github.ref_name }}' |
| 47 | + push: ${{ github.event_name != 'pull_request' }} |
| 48 | + tags: ${{ steps.meta.outputs.tags }} |
| 49 | + labels: ${{ steps.meta.outputs.labels }} |
0 commit comments