|
1 | 1 | name: Main Branch CI
|
2 | 2 |
|
3 |
| -# For all pushes to the main branch run the tests and push the image to the |
4 |
| -# GitHub registry under an edge tag so we can use it for the nightly |
5 |
| -# integration tests |
6 | 3 | on:
|
| 4 | + workflow_dispatch: |
7 | 5 | push:
|
8 |
| - branches: main |
| 6 | + branches: |
| 7 | + - 'main' |
| 8 | + tags: |
| 9 | + - 'v*' |
| 10 | + pull_request: |
| 11 | + branches: |
| 12 | + - 'main' |
9 | 13 |
|
10 | 14 | jobs:
|
11 | 15 | docker:
|
12 | 16 | runs-on: ubuntu-latest
|
13 | 17 | steps:
|
14 | 18 |
|
15 | 19 | - name: Check Out Repo
|
16 |
| - uses: actions/checkout@v2 |
| 20 | + uses: actions/checkout@v4 |
| 21 | + |
| 22 | + - name: Docker meta |
| 23 | + id: meta |
| 24 | + uses: docker/metadata-action@v5 |
| 25 | + with: |
| 26 | + images: coryaent/krause |
17 | 27 |
|
18 | 28 | - name: Set up Docker Buildx
|
19 | 29 | id: buildx
|
20 |
| - uses: docker/setup-buildx-action@v1 |
| 30 | + uses: docker/setup-buildx-action@v3 |
21 | 31 |
|
22 | 32 | - name: Cache Docker layers
|
23 |
| - uses: actions/cache@v2 |
| 33 | + uses: actions/cache@v3 |
24 | 34 | with:
|
25 | 35 | path: /tmp/.buildx-cache
|
26 | 36 | key: ${{ runner.os }}-buildx-${{ github.sha }}
|
27 | 37 | restore-keys: |
|
28 | 38 | ${{ runner.os }}-buildx-
|
29 | 39 |
|
30 | 40 | - name: Login to Docker Hub
|
31 |
| - uses: docker/login-action@v1 |
| 41 | + uses: docker/login-action@v3 |
32 | 42 | with:
|
33 | 43 | username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
34 | 44 | password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
35 | 45 |
|
| 46 | + - name: Login to GitHub Container Registry |
| 47 | + uses: docker/login-action@v3 |
| 48 | + with: |
| 49 | + registry: ghcr.io |
| 50 | + username: ${{ github.actor }} |
| 51 | + password: ${{ secrets.GHCR_TOKEN }} |
| 52 | + |
36 | 53 | - name: Build and push
|
37 | 54 | id: docker_build
|
38 |
| - uses: docker/build-push-action@v2 |
| 55 | + uses: docker/build-push-action@v5 |
39 | 56 | with:
|
40 | 57 | context: ./
|
41 | 58 | file: ./Dockerfile
|
42 | 59 | builder: ${{ steps.buildx.outputs.name }}
|
43 |
| - push: true |
44 |
| - tags: stevecorya/keyes:latest |
| 60 | + push: ${{ github.event_name != 'pull_request' }} |
| 61 | + tags: ${{ steps.meta.outputs.tags }} |
| 62 | + labels: ${{ steps.meta.outputs.labels }} |
45 | 63 | cache-from: type=local,src=/tmp/.buildx-cache
|
46 | 64 | cache-to: type=local,dest=/tmp/.buildx-cache
|
47 | 65 |
|
|
52 | 70 |
|
53 | 71 | if: always()
|
54 | 72 | with:
|
55 |
| - chat: ${{ secrets.TELEGRAM_USER_ID }} # user id or channel name secret |
56 |
| - token: ${{ secrets.TELEGRAM_BOT_TOKEN }} # token secret |
57 |
| - status: ${{ job.status }} # do not modify this line |
| 73 | + chat: ${{ secrets.TELEGRAM_USER_ID }} |
| 74 | + token: ${{ secrets.TELEGRAM_BOT_TOKEN }} |
| 75 | + status: ${{ job.status }} |
0 commit comments