aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows
diff options
context:
space:
mode:
authorChristian Marangi <ansuelsmth@gmail.com>2022-11-27 19:45:38 +0100
committerChristian Marangi <ansuelsmth@gmail.com>2022-12-04 16:03:22 +0100
commit75550771ae76fbcab4160e10b73287f918727384 (patch)
treef1910f0c98942f04cc883bac1a7f54963aa8354a /.github/workflows
parentada4d0d0abefe776fb633a7d7974d766465940f5 (diff)
downloadupstream-75550771ae76fbcab4160e10b73287f918727384.tar.gz
upstream-75550771ae76fbcab4160e10b73287f918727384.tar.bz2
upstream-75550771ae76fbcab4160e10b73287f918727384.zip
CI: tools: support per branch tools container
Add support to push per branch container tools. For anything not official stick to latest tag that correspond to test run from master. If we are testing something for one of the openwrt stable branch, parse the branch name or the tag and push dedicated tools containers. To use the stable container for local testing the branch needs to have the prefix openwrt-[0-9][0-9].[0-9][0-9] (example openwrt-21.02-fixup) Any branch that will match this pattern openwrt-[0-9][0-9].[0-9][0-9] will refresh the tools container with the matching tag. (example branch openwrt-22.03 -> tools:openwrt-22.03) (example branch openwrt-22.03-test -> tools:openwrt-22.03) Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/tools.yml27
1 files changed, 26 insertions, 1 deletions
diff --git a/.github/workflows/tools.yml b/.github/workflows/tools.yml
index def01678c6..304b5f7d62 100644
--- a/.github/workflows/tools.yml
+++ b/.github/workflows/tools.yml
@@ -174,6 +174,31 @@ jobs:
run: |
echo "OWNER_LC=${OWNER,,}" >> "$GITHUB_ENV"
+ # Per branch tools container tag
+ # By default stick to latest
+ # For official test targetting openwrt stable branch
+ # Get the branch or parse the tag and push dedicated tools containers
+ # Any branch that will match this pattern openwrt-[0-9][0-9].[0-9][0-9]
+ # will refresh the tools container with the matching tag.
+ # (example branch openwrt-22.03 -> tools:openwrt-22.03)
+ # (example branch openwrt-22.03-test -> tools:openwrt-22.03)
+ - name: Determine tools container tag
+ run: |
+ CONTAINER_TAG=latest
+
+ if [ ${{ github.ref_type }} == "branch" ]; then
+ if echo "${{ github.ref_name }}" | grep -q -E 'openwrt-[0-9][0-9]\.[0-9][0-9]'; then
+ CONTAINER_TAG="$(echo ${{ github.ref_name }} | sed 's/^\(openwrt-[0-9][0-9]\.[0-9][0-9]\).*/\1/')"
+ fi
+ elif [ ${{ github.ref_type }} == "tag" ]; then
+ if echo "${{ github.ref_name }}" | grep -q -E 'v[0-9][0-9]\.[0-9][0-9]\..+'; then
+ CONTAINER_TAG=openwrt-"$(echo ${{ github.ref_name }} | sed 's/v\([0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')"
+ fi
+ fi
+
+ echo "Tools container to push tools:$CONTAINER_TAG"
+ echo "CONTAINER_TAG=$CONTAINER_TAG" >> "$GITHUB_ENV"
+
- name: Checkout
uses: actions/checkout@v3
with:
@@ -197,5 +222,5 @@ jobs:
with:
context: openwrt
push: true
- tags: ghcr.io/${{ env.OWNER_LC }}/tools:latest
+ tags: ghcr.io/${{ env.OWNER_LC }}/tools:${{ env.CONTAINER_TAG }}
file: openwrt/.github/workflows/Dockerfile.tools