|
1 | 1 | name: StarWarden Build
|
2 | 2 |
|
3 | 3 | on:
|
4 |
| - release: |
5 |
| - types: [published] |
6 |
| - workflow_dispatch: |
| 4 | + release: |
| 5 | + types: [published] |
| 6 | + workflow_dispatch: |
7 | 7 |
|
8 | 8 | env:
|
9 |
| - DOCKER_IMAGE: rtuszik/starwarden |
| 9 | + DOCKER_IMAGE: rtuszik/starwarden |
10 | 10 |
|
11 | 11 | jobs:
|
12 |
| - build-and-push: |
13 |
| - runs-on: ubuntu-latest |
14 |
| - steps: |
15 |
| - - name: Checkout code |
16 |
| - uses: actions/checkout@v4 |
| 12 | + build-and-push: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Checkout code |
| 16 | + uses: actions/checkout@v4 |
17 | 17 |
|
18 |
| - - name: Set up Docker Buildx |
19 |
| - uses: docker/setup-buildx-action@v3 |
| 18 | + - name: Set up Docker Buildx |
| 19 | + uses: docker/setup-buildx-action@v3 |
20 | 20 |
|
21 |
| - - name: Login to Docker Hub |
22 |
| - uses: docker/login-action@v3 |
23 |
| - with: |
24 |
| - username: ${{ secrets.DOCKERHUB_USERNAME }} |
25 |
| - password: ${{ secrets.DOCKERHUB_TOKEN }} |
26 |
| - - name: Extract metadata (tags, labels) for Docker |
27 |
| - id: meta |
28 |
| - uses: docker/metadata-action@v5 |
29 |
| - with: |
30 |
| - images: ${{ env.DOCKER_IMAGE }} |
31 |
| - tags: | |
32 |
| - type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} |
33 |
| - type=semver,pattern={{version}},enable=${{ github.event_name == 'release' }} |
34 |
| - type=semver,pattern={{major}}.{{minor}},enable=${{ github.event_name == 'release' }} |
35 |
| - type=ref,event=branch |
36 |
| - type=ref,event=pr |
37 |
| - type=sha,prefix=sha- |
| 21 | + - name: Login to Docker Hub |
| 22 | + uses: docker/login-action@v3 |
| 23 | + with: |
| 24 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 25 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 26 | + - name: Extract metadata (tags, labels) for Docker |
| 27 | + id: meta |
| 28 | + uses: docker/metadata-action@v5 |
| 29 | + with: |
| 30 | + images: ${{ env.DOCKER_IMAGE }} |
| 31 | + tags: | |
| 32 | + type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} |
| 33 | + type=semver,pattern={{version}},enable=${{ github.event_name == 'release' }} |
| 34 | + type=semver,pattern={{major}}.{{minor}},enable=${{ github.event_name == 'release' }} |
| 35 | + type=ref,event=branch |
| 36 | + type=ref,event=pr |
| 37 | + type=sha,prefix=sha- |
38 | 38 |
|
39 |
| - - name: Build and push |
40 |
| - id: docker_build |
41 |
| - uses: docker/build-push-action@v6 |
42 |
| - with: |
43 |
| - context: . |
44 |
| - file: ./Dockerfile |
45 |
| - push: ${{ github.event_name != 'pull_request' }} |
46 |
| - tags: ${{ steps.meta.outputs.tags }} |
47 |
| - labels: ${{ steps.meta.outputs.labels }} |
48 |
| - cache-from: type=registry,ref=${{ env.DOCKER_IMAGE }}:buildcache |
49 |
| - cache-to: type=registry,ref=${{ env.DOCKER_IMAGE }}:buildcache,mode=max |
| 39 | + - name: Build and push |
| 40 | + id: docker_build |
| 41 | + uses: docker/build-push-action@v6 |
| 42 | + with: |
| 43 | + context: . |
| 44 | + file: ./Dockerfile |
| 45 | + push: ${{ github.event_name != 'pull_request' }} |
| 46 | + tags: ${{ steps.meta.outputs.tags }} |
| 47 | + labels: ${{ steps.meta.outputs.labels }} |
| 48 | + cache-from: type=registry,ref=${{ env.DOCKER_IMAGE }}:buildcache |
| 49 | + cache-to: type=registry,ref=${{ env.DOCKER_IMAGE }}:buildcache,mode=max |
| 50 | + platforms: linux/amd64,linux/arm64 |
50 | 51 |
|
51 |
| - - name: Image digest |
52 |
| - run: echo ${{ steps.docker_build.outputs.digest }} |
| 52 | + - name: Image digest |
| 53 | + run: echo ${{ steps.docker_build.outputs.digest }} |
0 commit comments