name: Docker Image CI on: push: branches: - main permissions: contents: read jobs: build: timeout-minutes: 180 runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false # The Dockerfile does not build WeKan from source — it DOWNLOADS the prebuilt # release zip (wekan--amd64.zip) that release-all.yml publishes, and # `exit 8`s if it is missing. So this image can only be built once the release # for the version pinned in the Dockerfile is up. On a push during the release # window (the version was just bumped but the release job has not attached the # zip yet), or if the release failed, the asset 404s and this job failed hard # even though nothing here is wrong. Check first and SKIP (a notice, green run) # when the release is not published yet; the real image is built by # release-all.yml's docker job once the release is up. - name: Is the release this Dockerfile needs published yet? id: rel env: GH_TOKEN: ${{ github.token }} GITHUB_CTX_REPOSITORY: ${{ github.repository }} run: | set -euo pipefail VERSION="$(sed -n 's/^ARG VERSION=//p' Dockerfile | head -1)" asset="wekan-${VERSION}-amd64.zip" # The list is read whole BEFORE matching. `gh … | grep -q` lets grep exit # at the first match while gh is still writing; gh gets SIGPIPE, pipefail # makes the pipeline fail, and a PUBLISHED asset was reported missing - the # v12.39 Mac apps were skipped that way, with the bundles already attached. assets="$(gh release view "v${VERSION}" --repo "${GITHUB_CTX_REPOSITORY}" \ --json assets --jq '.assets[].name' 2>/dev/null || true)" if grep -qx "$asset" <<< "$assets"; then echo "build=yes" >> "$GITHUB_OUTPUT" echo "OK: $asset is on the v${VERSION} release; building the image." else echo "build=no" >> "$GITHUB_OUTPUT" echo "::notice::$asset is not on the v${VERSION} release yet - skipping. release-all.yml builds the image once the release is published." fi - name: Build the Docker image if: steps.rel.outputs.build == 'yes' run: docker build . --file Dockerfile --tag wekan:$(date +%s)