mirror of
https://github.com/elseif/MikroTikPatch
synced 2026-07-17 10:39:40 +00:00
Compare commits
No commits in common. "e07ec52d3476d6ba36296ee4d51a4438a4cbae75" and "57f2724d69157c50f7d03bd3e7f9cedeb1283518" have entirely different histories.
e07ec52d34
...
57f2724d69
102
.github/workflows/build_docker.yml
vendored
102
.github/workflows/build_docker.yml
vendored
@ -2,6 +2,16 @@ name: Build CHR Docker
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
channel:
|
||||
description: 'Channel (stable, long-term, testing, development)'
|
||||
required: true
|
||||
default: 'stable'
|
||||
type: choice
|
||||
options:
|
||||
- stable
|
||||
- long-term
|
||||
- testing
|
||||
- development
|
||||
version:
|
||||
description: "Specify version (e.g., 7.19.2), empty for latest"
|
||||
required: false
|
||||
@ -11,66 +21,29 @@ on:
|
||||
permissions:
|
||||
packages: write
|
||||
jobs:
|
||||
Prepare:
|
||||
runs-on: ubuntu-24.04
|
||||
outputs:
|
||||
MATRIX: ${{ steps.get_versions.outputs.MATRIX }}
|
||||
steps:
|
||||
- name: Get versions and generate matrix
|
||||
id: get_versions
|
||||
run: |
|
||||
VERSION="${{ inputs.version }}"
|
||||
if [ -n "$VERSION" ]; then
|
||||
MATRIX=$(jq -c -n '
|
||||
[
|
||||
{ "version": $VERSION, "channel": ""}
|
||||
]
|
||||
' --arg VERSION "$VERSION")
|
||||
else
|
||||
TIMESTAMP=$(date +%s)
|
||||
LONG_TERM=$(wget -nv -O - "https://upgrade.mikrotik.ltd/routeros/NEWESTa7.long-term?t=$TIMESTAMP" | cut -d ' ' -f1)
|
||||
STABLE=$(wget -nv -O - "https://upgrade.mikrotik.ltd/routeros/NEWESTa7.stable?t=$TIMESTAMP" | cut -d ' ' -f1)
|
||||
|
||||
echo "Long-term version: $LONG_TERM"
|
||||
echo "Stable version: $STABLE"
|
||||
if [ -z "$LONG_TERM" ]; then
|
||||
echo "Failed to get long-term version"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "$STABLE" ]; then
|
||||
echo "Failed to get stable version"
|
||||
exit 1
|
||||
fi
|
||||
MATRIX=$(jq -c -n '
|
||||
[
|
||||
{version: $LONG_TERM, channel: "long-term"},
|
||||
{version: $STABLE, channel: "stable"}
|
||||
]
|
||||
' --arg LONG_TERM "$LONG_TERM" --arg STABLE "$STABLE")
|
||||
fi
|
||||
echo "Generated matrix: $MATRIX"
|
||||
echo "MATRIX=$MATRIX" >> $GITHUB_OUTPUT
|
||||
|
||||
Build:
|
||||
runs-on: ubuntu-24.04
|
||||
needs: Prepare
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
matrix:
|
||||
include: ${{ fromJson(needs.Prepare.outputs.MATRIX) }}
|
||||
env:
|
||||
TZ: 'Asia/Shanghai'
|
||||
VERSION: ${{ matrix.version }}
|
||||
CHANNEL: ${{ matrix.channel }}
|
||||
CHANNEL: ${{ inputs.channel }}
|
||||
VERSION: ${{ inputs.version }}
|
||||
IMAGE: "ghcr.io/${{ github.repository_owner }}/chr"
|
||||
DOCKER_BUILD_SUMMARY: 'false'
|
||||
DOCKER_BUILD_RECORD_UPLOAD: 'false'
|
||||
|
||||
IS_LATEST: 'false'
|
||||
steps:
|
||||
- name: Show build info
|
||||
- name: Check Version
|
||||
id: version
|
||||
run: |
|
||||
echo "Version: ${{ env.VERSION }}"
|
||||
echo "Channel: ${{ env.CHANNEL }}"
|
||||
if [ -z "$VERSION" ]; then
|
||||
echo "Checking latest version from $CHANNEL channel..."
|
||||
TIMESTAMP=$(date +%s)
|
||||
NEWEST=$(wget -nv -O - "https://upgrade.mikrotik.ltd/routeros/NEWESTa7.$CHANNEL?t=$TIMESTAMP")
|
||||
VERSION=$(echo "$NEWEST" | cut -d ' ' -f1)
|
||||
echo "Latest version: $VERSION"
|
||||
if [ "$CHANNEL" = "stable" ]; then
|
||||
echo "IS_LATEST=true" >> $GITHUB_ENV
|
||||
fi
|
||||
fi
|
||||
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||
|
||||
- name: Download CHR image
|
||||
run: |
|
||||
@ -210,22 +183,11 @@ jobs:
|
||||
cache-to: type=gha,mode=max
|
||||
provenance: false
|
||||
sbom: false
|
||||
outputs: >
|
||||
type=image,
|
||||
annotation-index.org.opencontainers.image.title=MikroTik CHR RouterOS,
|
||||
annotation-index.org.opencontainers.image.description=MikroTik CHR (Cloud Hosted Router) running on QEMU with Docker,
|
||||
annotation-index.org.opencontainers.image.version=${{ env.VERSION }},
|
||||
annotation-index.org.opencontainers.image.url=https://mikrotik.ltd
|
||||
|
||||
- name: Update channel tags
|
||||
if: env.CHANNEL != ''
|
||||
- name: Update :latest tag for stable channel
|
||||
if: env.IS_LATEST == 'true'
|
||||
run: |
|
||||
TAGS="-t ${{ env.IMAGE }}:${{ env.CHANNEL }}"
|
||||
if [ "${{ env.CHANNEL }}" = "stable" ]; then
|
||||
TAGS="$TAGS -t ${{ env.IMAGE }}:latest"
|
||||
fi
|
||||
echo "Creating tags: $TAGS"
|
||||
docker buildx imagetools create $TAGS ${{ env.IMAGE }}:${{ env.VERSION }}
|
||||
docker buildx imagetools create -t ${{ env.IMAGE }}:latest ${{ env.IMAGE }}:${{ env.VERSION }}
|
||||
|
||||
- name: Save Docker Image as tar
|
||||
run: |
|
||||
@ -241,6 +203,6 @@ jobs:
|
||||
- name: Upload tar artifact
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: chr-${{ env.VERSION }}-docker-images
|
||||
path: artifacts/
|
||||
retention-days: 30
|
||||
name: chr-docker-image
|
||||
path: artifacts/*.tar
|
||||
archive: false
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user