1 name: Build and Push prebuilt tools container
7 - '.github/workflows/build-tools.yml'
8 - '.github/workflows/push-containers.yml'
9 - '.github/workflows/Dockerfile.tools'
15 group: ${{ github.workflow }}
16 cancel-in-progress: true
20 name: Build tools with buildbot container
21 if: ${{ github.repository_owner == 'openwrt' }}
22 uses: ./.github/workflows/build-tools.yml
24 generate_prebuilt_artifacts: true
27 needs: build-linux-buildbot
28 name: Push prebuilt tools container
29 if: ${{ github.repository_owner == 'openwrt' }}
30 runs-on: ubuntu-latest
37 - name: Set lower case owner name
39 OWNER: ${{ github.repository_owner }}
41 echo "OWNER_LC=${OWNER,,}" >> "$GITHUB_ENV"
43 # Per branch tools container tag
44 # By default stick to latest
45 # For official test targetting openwrt stable branch
46 # Get the branch or parse the tag and push dedicated tools containers
47 # Any branch that will match this pattern openwrt-[0-9][0-9].[0-9][0-9]
48 # will refresh the tools container with the matching tag.
49 # (example branch openwrt-22.03 -> tools:openwrt-22.03)
50 # (example branch openwrt-22.03-test -> tools:openwrt-22.03)
51 - name: Determine tools container tag
55 if [ ${{ github.ref_type }} == "branch" ]; then
56 if echo "${{ github.ref_name }}" | grep -q -E 'openwrt-[0-9][0-9]\.[0-9][0-9]'; then
57 CONTAINER_TAG="$(echo ${{ github.ref_name }} | sed 's/^\(openwrt-[0-9][0-9]\.[0-9][0-9]\).*/\1/')"
59 elif [ ${{ github.ref_type }} == "tag" ]; then
60 if echo "${{ github.ref_name }}" | grep -q -E 'v[0-9][0-9]\.[0-9][0-9]\..+'; then
61 CONTAINER_TAG=openwrt-"$(echo ${{ github.ref_name }} | sed 's/v\([0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')"
65 echo "Tools container to push tools:$CONTAINER_TAG"
66 echo "CONTAINER_TAG=$CONTAINER_TAG" >> "$GITHUB_ENV"
69 uses: actions/checkout@v3
73 - name: Download prebuilt tools from build job
74 uses: actions/download-artifact@v3
76 name: linux-buildbot-prebuilt-tools
79 - name: Extract prebuild tools
80 working-directory: openwrt
81 run: tar -xf tools.tar
83 - name: Login to GitHub Container Registry
84 uses: docker/login-action@v2
87 username: ${{ github.actor }}
88 password: ${{ secrets.GITHUB_TOKEN }}
90 - name: Build and push
91 uses: docker/build-push-action@v3
95 tags: ghcr.io/${{ env.OWNER_LC }}/tools:${{ env.CONTAINER_TAG }}
96 file: openwrt/.github/workflows/Dockerfile.tools