Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .dagger/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module dagger/harbor-cli

go 1.25.0
go 1.26.2

replace go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc => go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.14.0

Expand Down
79 changes: 79 additions & 0 deletions .github/workflows/alauda-auto-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Auto Tag for Alauda

on:
push:
branches:
- 'alauda-v*'

permissions:
contents: write

jobs:
tag:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

- name: Extract version and tag prefix
id: extract
run: |
BRANCH_NAME="${GITHUB_REF#refs/heads/}"
echo "Branch: $BRANCH_NAME"

PREFIX="${BRANCH_NAME%%-*}" # alauda
BASE_VERSION="${BRANCH_NAME#${PREFIX}-}" # v0.0.18

VERSION_NO_V="${BASE_VERSION#v}" # 0.0.18
MAJOR=$(echo "$VERSION_NO_V" | cut -d. -f1)
MINOR=$(echo "$VERSION_NO_V" | cut -d. -f2)
PATCH=$(echo "$VERSION_NO_V" | cut -d. -f3)

NEXT_PATCH=$((PATCH + 1))
NEXT_VERSION="v${MAJOR}.${MINOR}.${NEXT_PATCH}" # v0.0.19

TAG_PREFIX="${NEXT_VERSION}-${PREFIX}" # v0.0.19-alauda
echo "TAG_PREFIX=$TAG_PREFIX"

echo "tag_prefix=$TAG_PREFIX" >> $GITHUB_OUTPUT

- name: Find latest tag with this prefix
id: latest
run: |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Info (style/robustness): The tag extraction logic uses bash string manipulation. Consider adding validation to handle malformed branch names gracefully.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Info (style/robustness): The tag extraction logic uses bash string manipulation. Consider adding validation to ensure the branch name matches expected format before processing.

TAG_PREFIX="${{ steps.extract.outputs.tag_prefix }}"
echo "Looking for tags with prefix: $TAG_PREFIX"

EXISTING_TAGS=$(git tag --list "${TAG_PREFIX}-*" | sort -V)
echo "Existing tags: $EXISTING_TAGS"

MAX_INDEX=-1
for tag in $EXISTING_TAGS; do
NUM=${tag##*-}
if [[ "$NUM" =~ ^[0-9]+$ && "$NUM" -gt "$MAX_INDEX" ]]; then
MAX_INDEX=$NUM
fi
done

NEW_INDEX=$((MAX_INDEX + 1))
NEW_TAG="${TAG_PREFIX}-${NEW_INDEX}"

echo "new_tag=$NEW_TAG" >> $GITHUB_OUTPUT

- name: Create and push new tag
run: |
NEW_TAG="${{ steps.latest.outputs.new_tag }}"
echo "Creating tag: $NEW_TAG"
git tag "$NEW_TAG"
git push origin "$NEW_TAG"

release:
name: Release Alauda
needs: [tag]
uses: ./.github/workflows/release-alauda.yml
26 changes: 13 additions & 13 deletions .github/workflows/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,12 @@ jobs:
id-token: write
runs-on: ubuntu-latest
if: |
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && !contains(github.ref, '-alauda-')) ||
(github.event_name == 'workflow_dispatch')
steps:
- name: Checkout repo
if: |
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && !contains(github.ref, '-alauda-')) ||
(github.event_name == 'workflow_dispatch')
uses: actions/checkout@v4
with:
Expand All @@ -292,13 +292,13 @@ jobs:

- name: Create Build Dir
if: |
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && !contains(github.ref, '-alauda-')) ||
(github.event_name == 'workflow_dispatch')
run: mkdir -p dist

- name: Building Binaries
if: |
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && !contains(github.ref, '-alauda-')) ||
(github.event_name == 'workflow_dispatch')
uses: dagger/dagger-for-github@v7
with:
Expand All @@ -308,7 +308,7 @@ jobs:

- name: Archiving Binaries
if: |
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && !contains(github.ref, '-alauda-')) ||
(github.event_name == 'workflow_dispatch')
uses: dagger/dagger-for-github@v7
with:
Expand All @@ -318,7 +318,7 @@ jobs:

- name: Building SBOM
if: |
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && !contains(github.ref, '-alauda-')) ||
(github.event_name == 'workflow_dispatch')
uses: dagger/dagger-for-github@v7
with:
Expand All @@ -328,7 +328,7 @@ jobs:

- name: NFPM Build (deb/rpm)
if: |
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && !contains(github.ref, '-alauda-')) ||
(github.event_name == 'workflow_dispatch')
uses: dagger/dagger-for-github@v7
with:
Expand All @@ -338,7 +338,7 @@ jobs:

- name: APK Build (.apk)
if: |
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && !contains(github.ref, '-alauda-')) ||
(github.event_name == 'workflow_dispatch')
uses: dagger/dagger-for-github@v7
with:
Expand All @@ -348,7 +348,7 @@ jobs:

- name: Creating Checksum
if: |
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && !contains(github.ref, '-alauda-')) ||
(github.event_name == 'workflow_dispatch')
uses: dagger/dagger-for-github@v7
with:
Expand All @@ -358,7 +358,7 @@ jobs:

- name: Publish Release
if: |
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && !contains(github.ref, '-alauda-')) ||
(github.event_name == 'workflow_dispatch')
uses: dagger/dagger-for-github@v7
env:
Expand All @@ -370,7 +370,7 @@ jobs:

- name: Apt Build
if: |
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && !contains(github.ref, '-alauda-')) ||
(github.event_name == 'workflow_dispatch')
uses: dagger/dagger-for-github@v7
env:
Expand All @@ -382,7 +382,7 @@ jobs:

- name: Upload Build Artifact
if: |
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && !contains(github.ref, '-alauda-')) ||
(github.event_name == 'workflow_dispatch')
uses: actions/upload-artifact@v4
with:
Expand All @@ -391,7 +391,7 @@ jobs:

- name: Publish and Sign Tagged Image
if: |
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && !contains(github.ref, '-alauda-')) ||
(github.event_name == 'workflow_dispatch')
uses: ./.github/actions/publish-and-sign
with:
Expand Down
58 changes: 58 additions & 0 deletions .github/workflows/release-alauda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Release Alauda

on:
push:
tags:
- "v*-alauda-*"
workflow_call:
workflow_dispatch:

permissions:
contents: write

jobs:
release:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning (reliability/unknown-action): The sagikazarmark/dagger-version-action@v0.0.1 is a version 0.0.1 action from an external maintainer. Consider pinning to a specific version or verifying the action's reliability in production.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning (reliability/unknown-action): The sagikazarmark/dagger-version-action@v0.0.1 is a relatively unknown third-party action. Consider verifying its maintenance status or pinning to a specific commit hash for reproducibility.

name: alauda-release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning (perf/missing-artifacts): The workflow builds binaries but doesn't upload them as artifacts. If the release fails, there's no way to access the built artifacts for debugging. Consider adding an actions/upload-artifact step.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning (perf/missing-artifacts): The workflow builds binaries but doesn't upload them as artifacts. Consider adding an actions/upload-artifact step for debugging purposes.

with:
fetch-depth: 0

- name: Dagger Version
id: dagger_version
uses: sagikazarmark/dagger-version-action@v0.0.1

- name: Create Build Dir
run: mkdir -p dist

- name: Build Binaries
uses: dagger/dagger-for-github@v7
with:
version: ${{ steps.dagger_version.outputs.version }}
verb: call
args: "build --build-dir=./dist export --path=./dist"

- name: Archive Binaries
uses: dagger/dagger-for-github@v7
with:
version: ${{ steps.dagger_version.outputs.version }}
verb: call
args: "archive --build-dir=./dist export --path=./dist"

- name: Create Checksum
uses: dagger/dagger-for-github@v7
with:
version: ${{ steps.dagger_version.outputs.version }}
verb: call
args: "checksum --build-dir=./dist export --path=./dist"

- name: Publish Release
uses: dagger/dagger-for-github@v7
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
version: ${{ steps.dagger_version.outputs.version }}
verb: call
args: "publish-release --build-dir=./dist --token=env://GITHUB_TOKEN"
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/goharbor/harbor-cli

go 1.24.8
go 1.26.2

require (
github.com/atotto/clipboard v0.1.4
Expand Down
7 changes: 7 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["github>AlaudaDevops/renovate-config:base"],
"baseBranches": ["/^alauda-v.*/"],
"postUpdateOptions": ["gomodTidy"],
"assignees": ["chengjingtao"]
}
Loading