|
5 | 5 | push:
|
6 | 6 | branches:
|
7 | 7 | - master
|
| 8 | + tags: |
| 9 | + - 'v*' |
8 | 10 |
|
9 | 11 | jobs:
|
10 | 12 | buildx:
|
11 | 13 | runs-on: ubuntu-latest
|
12 | 14 | steps:
|
13 | 15 | - name: Checkout
|
14 |
| - uses: actions/checkout@v3 |
| 16 | + uses: actions/checkout@v4 |
15 | 17 | with:
|
16 | 18 | submodules: true
|
17 | 19 |
|
| 20 | + - name: Extract metadata |
| 21 | + id: meta |
| 22 | + uses: docker/metadata-action@v5 |
| 23 | + with: |
| 24 | + images: ${{ secrets.DOCKER_USERNAME }}/filecodebox |
| 25 | + tags: | |
| 26 | + type=ref,event=branch |
| 27 | + type=ref,event=pr |
| 28 | + type=semver,pattern={{version}} |
| 29 | + type=semver,pattern={{major}}.{{minor}} |
| 30 | + type=raw,value=beta,enable={{is_default_branch}} |
| 31 | + type=raw,value=latest,enable={{is_default_branch}} |
| 32 | +
|
18 | 33 | - name: Set up QEMU
|
19 |
| - uses: docker/setup-qemu-action@v2 |
| 34 | + uses: docker/setup-qemu-action@v3 |
20 | 35 |
|
21 | 36 | - name: Set up Docker Buildx
|
22 |
| - uses: docker/setup-buildx-action@v2 |
23 |
| - |
24 |
| - - name: Cache Docker layers |
25 |
| - uses: actions/cache@v3 |
26 |
| - with: |
27 |
| - path: /tmp/.buildx-cache |
28 |
| - key: ${{ runner.os }}-buildx-${{ github.sha }} |
29 |
| - restore-keys: | |
30 |
| - ${{ runner.os }}-buildx- |
| 37 | + uses: docker/setup-buildx-action@v3 |
31 | 38 |
|
32 | 39 | - name: Login to DockerHub
|
33 |
| - uses: docker/login-action@v2 |
| 40 | + uses: docker/login-action@v3 |
34 | 41 | with:
|
35 | 42 | username: ${{ secrets.DOCKER_USERNAME }}
|
36 | 43 | password: ${{ secrets.DOCKER_PASSWORD }}
|
37 | 44 |
|
38 | 45 | - name: Build and push
|
39 |
| - uses: docker/build-push-action@v4 |
| 46 | + uses: docker/build-push-action@v5 |
40 | 47 | with:
|
41 | 48 | context: .
|
42 | 49 | platforms: linux/amd64,linux/arm64
|
43 | 50 | push: true
|
44 |
| - tags: ${{ secrets.DOCKER_USERNAME }}/filecodebox:beta |
45 |
| - cache-from: type=local,src=/tmp/.buildx-cache |
46 |
| - cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max |
47 |
| - - name: Move cache |
48 |
| - run: | |
49 |
| - rm -rf /tmp/.buildx-cache |
50 |
| - mv /tmp/.buildx-cache-new /tmp/.buildx-cache |
| 51 | + tags: ${{ steps.meta.outputs.tags }} |
| 52 | + labels: ${{ steps.meta.outputs.labels }} |
| 53 | + cache-from: type=gha |
| 54 | + cache-to: type=gha,mode=max |
0 commit comments