diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..73ebbe3 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,31 @@ +name: CD Docker Hub + +on: + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Clone repository + uses: actions/checkout@v4 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Get version + run: | + version=$(go run main.go -v) + echo "Current version: $version" + echo "ARTIFACT_VERSION=$version" >> $GITHUB_ENV + + - name: Build and push Docker image + run: | + docker build -t lifailon/lazyjournal:${{ env.ARTIFACT_VERSION }} . + docker push lifailon/lazyjournal:${{ env.ARTIFACT_VERSION }} + env: + ARTIFACT_VERSION: ${{ env.ARTIFACT_VERSION }} \ No newline at end of file