From 472e78fc5e5edeabccdde53be6dbfda53289922d Mon Sep 17 00:00:00 2001 From: Mo Tarbin Date: Sun, 15 Dec 2024 18:13:35 -0500 Subject: [PATCH] Merge the two Github workflow --- .github/workflows/docker-image-release.yml | 82 +++++++++++----------- .github/workflows/go-release.yml | 19 ++++- 2 files changed, 59 insertions(+), 42 deletions(-) diff --git a/.github/workflows/docker-image-release.yml b/.github/workflows/docker-image-release.yml index d2e34fe..d3ad35c 100644 --- a/.github/workflows/docker-image-release.yml +++ b/.github/workflows/docker-image-release.yml @@ -1,52 +1,52 @@ -name: Build and Push Docker Image +# name: Build and Push Docker Image -on: - push: - branches: - - main +# on: +# push: +# branches: +# - main -jobs: - build: - name: Build and Push Docker Image - runs-on: ubuntu-latest +# 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 +# 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 - # chmod +x ./donetick +# # # 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 +# # 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 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 }} +# # # 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 }}/donetick:latest . +# # Build and tag Docker image +# - name: Build Docker image +# run: | +# docker build -t ${{ secrets.DOCKER_USERNAME }}/donetick:latest . - # Push Docker image - - name: Push Docker image - run: | - docker push ${{ secrets.DOCKER_USERNAME }}/donetick:latest +# # Push Docker image +# - name: Push Docker image +# run: | +# docker push ${{ secrets.DOCKER_USERNAME }}/donetick:latest diff --git a/.github/workflows/go-release.yml b/.github/workflows/go-release.yml index 8951701..a99c58d 100644 --- a/.github/workflows/go-release.yml +++ b/.github/workflows/go-release.yml @@ -10,6 +10,7 @@ on: jobs: build: runs-on: ubuntu-latest + name: Build and Push Docker Image steps: - name: Checkout Code uses: actions/checkout@v4 @@ -57,4 +58,20 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution # GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} - \ No newline at end of file + + # 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 }} + + # Build and tag Docker image + - name: Build Docker image + run: | + docker build -t ${{ secrets.DOCKER_USERNAME }}/donetick:latest . + + # Push Docker image + - name: Push Docker image + run: | + docker push ${{ secrets.DOCKER_USERNAME }}/donetick:latest \ No newline at end of file