name: Publish Docker Image on: push: tags: - '*' jobs: build-and-publish: runs-on: ubuntu-latest steps: - name: Check out the repository uses: actions/checkout@v3 - name: Extract tag name id: get_tag run: echo "::set-output name=TAG_NAME::${GITHUB_REF#refs/tags/v}" - name: Log in to Docker Hub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build and push Docker image uses: docker/build-push-action@v3 with: context: . push: true tags: flyerhzm/synvert-ruby:${{ steps.get_tag.outputs.TAG_NAME }}