Skip to content

Commit

Permalink
push to docker
Browse files Browse the repository at this point in the history
  • Loading branch information
Himasnhu-AT committed Sep 2, 2024
1 parent a9c0538 commit 47f31bb
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/pushtohub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Rust

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
pushToHub:
runs-on: ubuntu-latest

steps:
- name: Check out the repository
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Log in to Docker Hub using PAT
run: echo "${{ secrets.DOCKER_PAT }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin

- name: Get version from Cargo.toml
id: cargo
run: |
echo "::set-output name=version::$(cargo metadata --format-version=1 | jq -r '.packages[] | select(.name == "git-history") | .version')"
shell: bash

- name: Build and Push Docker Image
run: |
docker build -t ${{ secrets.DOCKER_USERNAME }}/git-history:${{ steps.cargo.outputs.version }} -f dockerfile.public .
docker push ${{ secrets.DOCKER_USERNAME }}/git-history:${{ steps.cargo.outputs.version }}

0 comments on commit 47f31bb

Please sign in to comment.