|
30 | 30 | workflow_dispatch:
|
31 | 31 |
|
32 | 32 | jobs:
|
33 |
| - test: |
34 |
| - runs-on: ubuntu-latest |
35 |
| - strategy: |
36 |
| - matrix: |
37 |
| - architecture: [linux/amd64] |
38 |
| - steps: |
39 |
| - - name: Checkout |
40 |
| - uses: actions/checkout@v2 |
41 |
| - with: |
42 |
| - submodules: "recursive" |
43 |
| - - name: Set up QEMU |
44 |
| - uses: docker/setup-qemu-action@v1 |
45 |
| - - name: Set up Docker Buildx |
46 |
| - uses: docker/setup-buildx-action@v1 |
47 |
| - - name: Cache Docker layers |
48 |
| - uses: actions/cache@v2 |
49 |
| - with: |
50 |
| - path: /tmp/.buildx-cache/${{ matrix.architecture }} |
51 |
| - key: ${{ runner.os }}-buildx-${{ matrix.architecture }}-${{ github.sha }} |
52 |
| - - name: Build |
53 |
| - uses: docker/build-push-action@v2 |
54 |
| - with: |
55 |
| - context: . |
56 |
| - platforms: ${{ matrix.architecture }} |
57 |
| - cache-from: type=local,src=/tmp/.buildx-cache/${{ matrix.architecture }} |
58 |
| - cache-to: type=local,dest=/tmp/.buildx-cache-new/${{ matrix.architecture }},mode=max |
59 |
| - - name: Move cache |
60 |
| - run: | |
61 |
| - rm -rf /tmp/.buildx-cache/${{ matrix.architecture }} |
62 |
| - mv /tmp/.buildx-cache-new/${{ matrix.architecture }} /tmp/.buildx-cache/${{ matrix.architecture }} |
63 |
| -
|
64 | 33 | publish:
|
65 |
| - needs: [test] |
66 | 34 | runs-on: ubuntu-latest
|
67 | 35 | if: github.event_name != 'pull_request'
|
68 | 36 | steps:
|
69 | 37 | - name: Checkout
|
70 |
| - uses: actions/checkout@v2 |
| 38 | + uses: actions/checkout@v4 |
71 | 39 | with:
|
72 | 40 | submodules: "recursive"
|
73 | 41 | - name: Set up QEMU
|
74 |
| - uses: docker/setup-qemu-action@v1 |
| 42 | + uses: docker/setup-qemu-action@v3 |
75 | 43 | - name: Set up Docker Buildx
|
76 |
| - uses: docker/setup-buildx-action@v1 |
77 |
| - - name: Cache amd64 Docker layers |
78 |
| - uses: actions/cache@v2 |
79 |
| - with: |
80 |
| - path: /tmp/.buildx-cache/linux/amd64 |
81 |
| - key: ${{ runner.os }}-buildx-linux/amd64-${{ github.sha }} |
| 44 | + uses: docker/setup-buildx-action@v3 |
82 | 45 | - name: Docker meta
|
83 | 46 | id: meta
|
84 | 47 | uses: docker/metadata-action@v3
|
85 | 48 | with:
|
86 | 49 | images: revoltchat/client, ghcr.io/revoltchat/client
|
87 | 50 | - name: Login to DockerHub
|
88 | 51 | uses: docker/login-action@v1
|
| 52 | + if: github.event_name != 'pull_request' |
89 | 53 | with:
|
90 | 54 | username: ${{ secrets.DOCKERHUB_USERNAME }}
|
91 | 55 | password: ${{ secrets.DOCKERHUB_TOKEN }}
|
92 | 56 | - name: Login to Github Container Registry
|
93 |
| - uses: docker/login-action@v1 |
| 57 | + uses: docker/login-action@v3 |
| 58 | + if: github.event_name != 'pull_request' |
94 | 59 | with:
|
95 | 60 | registry: ghcr.io
|
96 | 61 | username: ${{ github.actor }}
|
97 | 62 | password: ${{ secrets.GITHUB_TOKEN }}
|
98 | 63 | - name: Build and publish
|
99 |
| - uses: docker/build-push-action@v2 |
| 64 | + uses: docker/build-push-action@v6 |
100 | 65 | with:
|
101 | 66 | context: .
|
102 |
| - push: true |
| 67 | + push: ${{ github.event_name != 'pull_request' }} |
103 | 68 | platforms: linux/amd64
|
104 | 69 | tags: ${{ steps.meta.outputs.tags }}
|
105 | 70 | labels: ${{ steps.meta.outputs.labels }}
|
106 |
| - cache-from: type=local,src=/tmp/.buildx-cache/linux/amd64 |
107 |
| - cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max |
108 |
| - - name: Move cache |
109 |
| - run: | |
110 |
| - rm -rf /tmp/.buildx-cache |
111 |
| - mv /tmp/.buildx-cache-new /tmp/.buildx-cache |
0 commit comments