From f9572b6dbe2370bb0897ae42244ea92dff2fa02b Mon Sep 17 00:00:00 2001 From: Dmitry Smirnov Date: Tue, 10 Sep 2024 11:41:21 +0300 Subject: [PATCH] docker release test --- .github/workflows/release.yml | 79 +++++++++++++++++++++++++---------- 1 file changed, 57 insertions(+), 22 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 16f0abf1..d0dfbb98 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,8 +2,8 @@ name: Release UDX Worker on: push: - branches: - - latest + # branches: + # - latest jobs: test-pipeline: @@ -47,8 +47,43 @@ jobs: echo "$CHANGELOG" >> $GITHUB_ENV echo "EOF" >> $GITHUB_ENV - github-release: + # github-release: + # runs-on: ubuntu-latest + # needs: [test-pipeline] + # permissions: + # contents: write + # steps: + # - name: Checkout code + # uses: actions/checkout@v4 + # with: + # fetch-depth: 0 + + # - name: Configure git for pushing + # run: | + # git config --global user.email "worker@udx.io" + # git config --global user.name "UDX Worker" + + # - name: Create GitHub Tag + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # run: | + # git tag ${{ needs.test-pipeline.outputs.semVer }} + # git push origin ${{ needs.test-pipeline.outputs.semVer }} + + # - name: Create GitHub release + # uses: actions/create-release@v1 + # with: + # tag_name: ${{ needs.test-pipeline.outputs.semVer }} + # release_name: ${{ needs.test-pipeline.outputs.semVer }} + # body: ${{ needs.test-pipeline.outputs.changelog }} + # draft: false + # prerelease: false + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + docker-release: runs-on: ubuntu-latest + # needs: [test-pipeline, github-release] needs: [test-pipeline] permissions: contents: write @@ -58,25 +93,25 @@ jobs: with: fetch-depth: 0 - - name: Configure git for pushing - run: | - git config --global user.email "worker@udx.io" - git config --global user.name "UDX Worker" + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - - name: Create GitHub Tag - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - git tag ${{ needs.test-pipeline.outputs.semVer }} - git push origin ${{ needs.test-pipeline.outputs.semVer }} + - name: Log in to Docker Hub + uses: docker/login-action@v2 + with: + password: ${{ secrets.DOCKER_TOKEN }} - - name: Create GitHub release - uses: actions/create-release@v1 + - name: Build and push Docker image + uses: docker/build-push-action@v2 with: - tag_name: ${{ needs.test-pipeline.outputs.semVer }} - release_name: ${{ needs.test-pipeline.outputs.semVer }} - body: ${{ needs.test-pipeline.outputs.changelog }} - draft: false - prerelease: false - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + context: . + file: ./Dockerfile + push: true + tags: | + udx-worker:${{ needs.test-pipeline.outputs.semVer }} + udx-worker:latest + build-args: | + GIT_VERSION=${{ needs.test-pipeline.outputs.semVer }} + + - name: Log out from Docker Hub + run: docker logout