diff options
author | Mo Tarbin <mhed.t91@gmail.com> | 2024-09-05 21:15:40 -0400 |
---|---|---|
committer | Mo Tarbin <mhed.t91@gmail.com> | 2024-09-05 21:15:40 -0400 |
commit | 0cdf6bb75bc0117245f37c665d750cdb80704d97 (patch) | |
tree | aa8eb5fbe28f1cc4d8f31b535625dc8bf69efb8a /.github/workflows | |
parent | 229e843e4c3965a501db69282dc772e45339393f (diff) | |
download | donetick-0cdf6bb75bc0117245f37c665d750cdb80704d97.tar.gz donetick-0cdf6bb75bc0117245f37c665d750cdb80704d97.tar.bz2 donetick-0cdf6bb75bc0117245f37c665d750cdb80704d97.zip |
Add workflow to Build and Push Docker Image
Diffstat (limited to '.github/workflows')
-rw-r--r-- | .github/workflows/docker-image-release.yml | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/.github/workflows/docker-image-release.yml b/.github/workflows/docker-image-release.yml new file mode 100644 index 0000000..4fe7157 --- /dev/null +++ b/.github/workflows/docker-image-release.yml @@ -0,0 +1,53 @@ +name: Build and Push Docker Image + +on: + push: + branches: + - dev + +jobs: + build: + name: Build and Push Docker Image + runs-on: ubuntu-latest + + steps: + # Checkout the code from the repository + - name: Checkout repository + uses: actions/checkout@v3 + + # Download the latest release binary from GitHub releases + - name: Download latest release binary + run: | + latest_release=$(curl --silent "https://api.github.com/repos/donetick/donetick/releases/latest" | jq -r '.tag_name') + curl -L "https://github.com/donetick/donetick/releases/download/${latest_release}/donetick_Linux_x86_64.tar.gz" -o donetick_Linux_x86_64.tar.gz + tar -xzf donetick_Linux_x86_64.tar.gz + mv donetick_Linux_x86_64/* . + chmod +x ./donetick + + + + # Log in to Docker Hub + - name: Log in to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + # Log in to GitHub Container Registry + - name: Login to GitHub Container Registry + uses: docker/login-action@v3.3.0 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + + # Build and tag Docker image + - name: Build Docker image + run: | + docker build -t ${{ secrets.DOCKER_USERNAME }}/my-go-app:${{ github.sha }} . + + # Push Docker image + - name: Push Docker image + run: | + docker push ${{ secrets.DOCKER_USERNAME }}/my-go-app:${{ github.sha }} |