Update rust.yml #96
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust CI/CD | |
on: | |
push: | |
branches: ["trunk"] | |
env: | |
CARGO_TERM_COLOR: always | |
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} | |
IMAGE_NAME: "camksingh/shield" | |
CIRCLECI_TOKEN: ${{ secrets.CIRCLECI_TOKEN }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build the project | |
run: cargo build --release --verbose | |
- name: Run tests | |
run: cargo test --verbose | |
- name: Log in to DockerHub | |
run: echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin | |
- name: Build Docker image | |
run: docker build -t $IMAGE_NAME:${{ github.sha }} . | |
- name: Push Docker image to DockerHub | |
run: | | |
docker tag $IMAGE_NAME:${{ github.sha }} $IMAGE_NAME:latest | |
docker push $IMAGE_NAME:${{ github.sha }} | |
docker push $IMAGE_NAME:latest |