|
1 |
| -name: Create and publish a Docker image |
2 |
| -on: |
3 |
| - workflow_run: |
4 |
| - workflows: [ "Rust" ] |
5 |
| - branches: [ "main" ] |
6 |
| - types: |
7 |
| - - completed |
| 1 | +name: CICD |
| 2 | + |
| 3 | +on: [ "push", "pull_request" ] |
8 | 4 |
|
9 | 5 | env:
|
| 6 | + CARGO_TERM_COLOR: always |
10 | 7 | REGISTRY: ghcr.io
|
11 | 8 | IMAGE_NAME: ${{ github.repository }}
|
12 | 9 |
|
13 | 10 | jobs:
|
14 |
| - build-and-push-image: |
| 11 | + tests: |
15 | 12 | runs-on: ubuntu-latest
|
16 |
| - if: ${{ github.event.workflow_run.conclusion == 'success' }} |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@v4 |
| 15 | + - run: sudo apt install libpcap-dev libsasl2-dev libssl-dev |
| 16 | + - name: Build |
| 17 | + run: cargo build --verbose |
| 18 | + - name: Run tests |
| 19 | + run: cargo test --verbose |
| 20 | + |
| 21 | + docker: |
| 22 | + strategy: |
| 23 | + fail-fast: false |
| 24 | + matrix: |
| 25 | + os: [ubuntu-24.04, ubuntu-24.04-arm] |
17 | 26 |
|
18 | 27 | permissions:
|
19 | 28 | contents: read
|
20 | 29 | packages: write
|
21 | 30 | attestations: write
|
22 | 31 | id-token: write
|
23 | 32 |
|
| 33 | + runs-on: ${{ matrix.os }} |
| 34 | + needs: [ tests ] |
24 | 35 | steps:
|
25 | 36 | - name: Checkout repository
|
26 | 37 | uses: actions/checkout@v4
|
27 | 38 |
|
28 | 39 | - name: Log in to the Container registry
|
29 |
| - uses: docker/login-action@327cd5a69de6c009b9ce71bce8395f28e651bf99 |
| 40 | + uses: docker/login-action@v3 |
30 | 41 | with:
|
31 | 42 | registry: ${{ env.REGISTRY }}
|
32 | 43 | username: ${{ github.actor }}
|
33 | 44 | password: ${{ secrets.GITHUB_TOKEN }}
|
34 | 45 |
|
35 | 46 | - name: Extract metadata (tags, labels) for Docker
|
36 | 47 | id: meta
|
37 |
| - uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 |
| 48 | + uses: docker/metadata-action@v5 |
38 | 49 | with:
|
39 | 50 | images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
40 | 51 |
|
41 |
| - - name: Sync theme submodule |
42 |
| - run: git submodule sync && git submodule update --init --recursive |
| 52 | + - name: Set up Docker Buildx |
| 53 | + uses: docker/setup-buildx-action@v3 |
43 | 54 |
|
44 | 55 | - name: Build and push Docker image
|
45 | 56 | id: push
|
46 |
| - uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 |
| 57 | + uses: docker/build-push-action@v6 |
47 | 58 | with:
|
48 | 59 | context: .
|
49 | 60 | push: true
|
| 61 | + provenance: false |
50 | 62 | tags: ${{ steps.meta.outputs.tags }}
|
51 | 63 | labels: ${{ steps.meta.outputs.labels }}
|
52 | 64 |
|
|
0 commit comments