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