Create publish.yml #6
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Create and publish a Docker image | |
| on: | |
| push: | |
| tags: | |
| - '*' | |
| branches: [ acceptance ] | |
| env: | |
| BRANCH_BUILD_TAGS: "acceptance" | |
| jobs: | |
| parse-docker-build-env: | |
| name: 'Parse Docker Build Environment' | |
| runs-on: ubuntu-latest | |
| outputs: | |
| buildTags: ${{ steps.detect-push-event.outputs.buildTags }} | |
| steps: | |
| - name: Check if push is a tag or branch | |
| id: detect-push-event | |
| run: | | |
| if [[ $GITHUB_REF == refs/tags/* ]]; then | |
| TAG="${GITHUB_REF#refs/tags/}" | |
| echo "This is a tag push ($TAG)" | |
| if [[ ! "$TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+-acc$ ]]; then | |
| echo "❌ Invalid tag format: $TAG" | |
| exit 1 | |
| fi | |
| echo "Building docker tag: ${GITHUB_REF#refs/tags/}" | |
| echo "buildTags=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| elif [[ $GITHUB_REF == refs/heads/* ]]; then | |
| echo "This is a branch push (${GITHUB_REF#refs/heads/})" | |
| echo "Building docker tags: ${{ env.BRANCH_BUILD_TAGS }}" | |
| echo "buildTags=${{ env.BRANCH_BUILD_TAGS }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "Unknown push type" | |
| exit 1 | |
| fi | |
| build-dockerhub-image: | |
| name: "Build Docker Images to DockerHub Registry" | |
| runs-on: ubuntu-latest | |
| needs: parse-docker-build-env | |
| steps: | |
| - uses: exo-actions/buildDockerImage-action@v1 | |
| with: | |
| dockerImage: "exoplatform/cloudbeaver" | |
| dockerImageTag: ${{ needs.parse-docker-build-env.outputs.buildTags }} | |
| DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
| DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} |