Updated README.md #33
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: Docker Publish | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - "[0-9]+.[0-9]+.[0-9]+" # Matches tags like 1.2.3 | |
| jobs: | |
| build_and_publish: | |
| name: Build and Publish Docker Images | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set image tags | |
| id: meta | |
| run: | | |
| if [[ "${GITHUB_REF}" =~ ^refs/tags/([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then | |
| VERSION="${BASH_REMATCH[1]}" | |
| MAJOR_MINOR="${VERSION%.*}" | |
| echo "APP_TAGS=ghcr.io/${{ github.repository }}:${VERSION},ghcr.io/${{ github.repository }}:latest,ghcr.io/${{ github.repository }}:${MAJOR_MINOR}" >> $GITHUB_ENV | |
| echo "DOC_TAGS=ghcr.io/${{ github.repository }}-docs:${VERSION},ghcr.io/${{ github.repository }}-docs:latest,ghcr.io/${{ github.repository }}-docs:${MAJOR_MINOR}" >> $GITHUB_ENV | |
| else | |
| SHA="${GITHUB_SHA::8}" | |
| echo "APP_TAGS=ghcr.io/${{ github.repository }}:${SHA}" >> $GITHUB_ENV | |
| echo "DOC_TAGS=ghcr.io/${{ github.repository }}-docs:${SHA}" >> $GITHUB_ENV | |
| fi | |
| - name: Build and push app | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: . | |
| push: true | |
| tags: ${{ env.APP_TAGS }} | |
| - name: Build and push docs | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: . | |
| file: Dockerfile.docs | |
| push: true | |
| tags: ${{ env.DOC_TAGS }} |