diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 7a014e6b9d54..bdea64963f8f 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -21,24 +21,8 @@ env: REGISTRY_IMAGE: openproject/community jobs: - build: - if: github.repository == 'opf/openproject' - runs-on: runs-on,runner=8cpu-linux,family=m7i+m7a,run-id=${{ github.run_id }} - strategy: - matrix: - include: - - platform: linux/amd64 - target: slim - - platform: linux/arm64/v8 - target: slim - - platform: linux/amd64 - target: all-in-one - - platform: linux/ppc64le - bim_support: false - target: all-in-one - - platform: linux/arm64/v8 - bim_support: false - target: all-in-one + extract_version: + runs-on: ubuntu-latest steps: - name: Extract version id: extract_version @@ -56,19 +40,43 @@ jobs: echo "Unsupported event" exit 1 fi - + if [ -z "$TAG_REF" ] || [ -z "$CHECKOUT_REF" ]; then echo "No TAG_REF or CHECKOUT_REF set. Aborting" exit 1 fi - + VERSION=${TAG_REF#v} echo "Version: $VERSION" - echo "::set-output name=version::$VERSION" - echo "::set-output name=checkout_ref::$CHECKOUT_REF" + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + echo "checkout_ref=$CHECKOUT_REF" >> "$GITHUB_OUTPUT" + outputs: + version: ${{ steps.extract_version.outputs.version }} + checkout_ref: ${{ steps.extract_version.outputs.checkout_ref }} + build: + needs: + - extract_version + if: github.repository == 'opf/openproject' + runs-on: runs-on,runner=8cpu-linux,family=m7i+m7a,run-id=${{ github.run_id }} + strategy: + matrix: + include: + - platform: linux/amd64 + target: slim + - platform: linux/arm64/v8 + target: slim + - platform: linux/amd64 + target: all-in-one + - platform: linux/ppc64le + bim_support: false + target: all-in-one + - platform: linux/arm64/v8 + bim_support: false + target: all-in-one + steps: - name: Checkout with: - ref: ${{ steps.extract_version.outputs.checkout_ref }} + ref: ${{ needs.extract_version.outputs.checkout_ref }} uses: actions/checkout@v4 - name: Prepare docker files run: | @@ -88,7 +96,7 @@ jobs: uses: docker/metadata-action@v4 with: tags: | - type=semver,pattern={{version}},value=${{ steps.extract_version.outputs.version }} + type=semver,pattern={{version}},value=${{ needs.extract_version.outputs.version }} images: | ${{ env.REGISTRY_IMAGE }} - name: Build image @@ -150,6 +158,7 @@ jobs: matrix: target: [slim, all-in-one] needs: + - extract_version - build steps: - name: Download digests @@ -178,9 +187,9 @@ jobs: latest=false suffix=${{ steps.set_suffix.outputs.suffix }} tags: | - type=semver,pattern={{version}},value=${{ steps.extract_version.outputs.version }} - type=semver,pattern={{major}}.{{minor}},value=${{ steps.extract_version.outputs.version }} - type=semver,pattern={{major}},value=${{ steps.extract_version.outputs.version }} + type=semver,pattern={{version}},value=${{ needs.extract_version.outputs.version }} + type=semver,pattern={{major}}.{{minor}},value=${{ needs.extract_version.outputs.version }} + type=semver,pattern={{major}},value=${{ needs.extract_version.outputs.version }} type=raw,value=dev,priority=200,enable={{is_default_branch}} - name: Login to Docker Hub uses: docker/login-action@v2