v7.29.0 #63
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: CD - Build Docker Image | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| rebuild: | |
| description: "Rebuild tag?" | |
| required: true | |
| default: "no" | |
| type: choice | |
| options: | |
| - "no" | |
| - "yes" | |
| concurrency: | |
| group: docker-${{ github.event.workflow_run.head_branch || github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| packages: write | |
| env: | |
| DEFAULT_PYTHON: "3.12" | |
| jobs: | |
| docker: | |
| name: Build Docker Image | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: release | |
| steps: | |
| - name: Check repo | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install poetry | |
| run: pipx install poetry | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "${{ env.DEFAULT_PYTHON }}" | |
| cache: "poetry" | |
| - name: Install dependencies | |
| run: | | |
| poetry install --no-root | |
| - name: Get current version (rebuild) | |
| if: ${{ inputs.rebuild == 'yes' }} | |
| run: | | |
| UIPROTECT_VERSION=$(git describe --tags --abbrev=0) | |
| echo "UIPROTECT_VERSION=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV | |
| echo "DOCKER_TAGS=ghcr.io/uilibs/uiprotect:dev,ghcr.io/uilibs/uiprotect:$UIPROTECT_VERSION" >> $GITHUB_ENV | |
| - name: Get current version (no rebuild) | |
| if: ${{ inputs.rebuild != 'yes' }} | |
| run: | | |
| UIPROTECT_VERSION=v$(poetry version -s) | |
| echo "UIPROTECT_VERSION=$UIPROTECT_VERSION" >> $GITHUB_ENV | |
| echo "DOCKER_TAGS=ghcr.io/uilibs/uiprotect:dev,ghcr.io/uilibs/uiprotect:$(echo $UIPROTECT_VERSION | tr "+" -)" >> $GITHUB_ENV | |
| - name: Add Latest Docker Tag | |
| run: | | |
| if [[ ! "$UIPROTECT_VERSION" == *"dev"* ]]; then | |
| echo "DOCKER_TAGS=ghcr.io/uilibs/uiprotect:latest,$DOCKER_TAGS" >> $GITHUB_ENV | |
| fi | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and Push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| target: prod | |
| push: true | |
| build-args: | | |
| UIPROTECT_VERSION=${{ env.UIPROTECT_VERSION }} | |
| cache-from: ghcr.io/uilibs/uiprotect:buildcache | |
| cache-to: type=registry,ref=ghcr.io/uilibs/uiprotect:buildcache,mode=max | |
| tags: ${{ env.DOCKER_TAGS }} |