Skip to content

Commit 92d6c2f

Browse files
Update docker-publish.yml
1 parent 3d4834d commit 92d6c2f

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed
Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
1-
name: Build and Push Docker Image
1+
name: Rust
22

33
on:
44
push:
5-
branches:
6-
- main
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
711

812
jobs:
9-
build-and-deploy:
13+
build:
1014
runs-on: ubuntu-latest
1115

1216
steps:
13-
- name: Checkout code
14-
uses: actions/checkout@v2
15-
16-
- name: Set up Docker Buildx
17-
uses: docker/setup-buildx-action@v2
18-
19-
- name: Cache Docker layers
20-
uses: actions/cache@v2
21-
with:
22-
path: /tmp/.buildx-cache
23-
key: ${{ runner.os }}-buildx-${{ github.sha }}
24-
restore-keys: |
25-
${{ runner.os }}-buildx-
26-
27-
- name: Log in to GitHub Container Registry
28-
uses: docker/login-action@v2
29-
with:
30-
registry: ghcr.io
31-
username: ${{ github.actor }}
32-
password: ${{ secrets.GITHUB_TOKEN }}
33-
34-
- name: Build and push Docker image
35-
uses: docker/build-push-action@v3
36-
with:
37-
context: .
38-
push: true
39-
tags: ghcr.io/${{ github.repository }}:latest
40-
cache-from: type=local,src=/tmp/.buildx-cache
41-
cache-to: type=local,dest=/tmp/.buildx-cache
17+
- uses: actions/checkout@v4
18+
19+
- name: Build
20+
run: cargo build --release --verbose
21+
22+
- name: Run tests
23+
run: cargo test --verbose
24+
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v2
27+
28+
- name: Log in to Docker Hub
29+
uses: docker/login-action@v2
30+
with:
31+
username: ${{ secrets.DOCKER_USERNAME }}
32+
password: ${{ secrets.DOCKER_PASSWORD }}
33+
34+
- name: Build and push Docker image
35+
uses: docker/build-push-action@v3
36+
with:
37+
context: .
38+
push: true
39+
tags: ${{ secrets.DOCKER_USERNAME }}/splitr:latest
40+
cache-from: type=local,src=/tmp/.buildx-cache
41+
cache-to: type=local,dest=/tmp/.buildx-cache

0 commit comments

Comments
 (0)