sync with version opmaat.org #2
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: Build and Push Docker Image | |
| on: | |
| push: | |
| branches: | |
| - '**' # all branches | |
| tags: | |
| - 'v*' # tags | |
| jobs: | |
| docker: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout source | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Extract Git ref and tag | |
| id: extract | |
| run: | | |
| echo "GIT_REF=${GITHUB_REF}" >> $GITHUB_OUTPUT | |
| echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
| # Extract sanitized branch name or tag | |
| if [[ "${GITHUB_REF}" == refs/heads/* ]]; then | |
| BRANCH_NAME="${GITHUB_REF#refs/heads/}" | |
| TAG_NAME=$(echo "${BRANCH_NAME}" | tr '[:upper:]' '[:lower:]' | sed 's#[^a-z0-9_.-]#-#g') | |
| elif [[ "${GITHUB_REF}" == refs/tags/* ]]; then | |
| TAG_NAME="${GITHUB_REF#refs/tags/}" | |
| else | |
| TAG_NAME="unknown" | |
| fi | |
| echo "DOCKER_TAG=${TAG_NAME}" >> $GITHUB_OUTPUT | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| tags: ghcr.io/ximeraproject/server:${{ steps.extract.outputs.DOCKER_TAG }} |