mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-13 00:26:53 +00:00
feat: optimize CI triggers and add latest version tracking to OSS (#33)
* feat: optimize CI triggers and add latest version tracking to OSS * feat: optimize CI triggers and add latest version tracking to OSS
This commit is contained in:
@@ -19,13 +19,19 @@ on:
|
|||||||
schedule:
|
schedule:
|
||||||
- cron: "0 0 * * 0" # at midnight of each sunday
|
- cron: "0 0 * * 0" # at midnight of each sunday
|
||||||
push:
|
push:
|
||||||
|
tags: ["v*", "*"]
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
tags: ["v*", "*"]
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-rustfs:
|
build-rustfs:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
# Only execute in the following cases: 1) tag push 2) scheduled run 3) commit message contains --build
|
||||||
|
if: |
|
||||||
|
startsWith(github.ref, 'refs/tags/') ||
|
||||||
|
github.event_name == 'schedule' ||
|
||||||
|
github.event_name == 'workflow_dispatch' ||
|
||||||
|
contains(github.event.head_commit.message, '--build')
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@@ -382,12 +388,6 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
echo "ossutil2 installation completed"
|
echo "ossutil2 installation completed"
|
||||||
|
|
||||||
# Set the OSS configuration
|
|
||||||
# ossutil config set Region oss-cn-beijing
|
|
||||||
# ossutil config set endpoint oss-cn-beijing.aliyuncs.com
|
|
||||||
# ossutil config set accessKeyID ${{ secrets.ALICLOUDOSS_KEY_ID }}
|
|
||||||
# ossutil config set accessKeySecret ${{ secrets.ALICLOUDOSS_KEY_SECRET }}
|
|
||||||
|
|
||||||
- name: Upload to Aliyun OSS
|
- name: Upload to Aliyun OSS
|
||||||
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main'
|
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main'
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -403,6 +403,44 @@ jobs:
|
|||||||
ossutil cp "${{ steps.package.outputs.artifact_name }}.zip" "oss://rustfs-artifacts/artifacts/rustfs/${{ steps.package.outputs.artifact_name }}.latest.zip" --force
|
ossutil cp "${{ steps.package.outputs.artifact_name }}.zip" "oss://rustfs-artifacts/artifacts/rustfs/${{ steps.package.outputs.artifact_name }}.latest.zip" --force
|
||||||
echo "Successfully uploaded artifacts to OSS"
|
echo "Successfully uploaded artifacts to OSS"
|
||||||
|
|
||||||
|
# Create and upload latest version info
|
||||||
|
- name: Create and Upload latest.json
|
||||||
|
if: startsWith(github.ref, 'refs/tags/') && matrix.os == 'ubuntu-latest' && matrix.variant.target == 'x86_64-unknown-linux-musl'
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
OSS_ACCESS_KEY_ID: ${{ secrets.ALICLOUDOSS_KEY_ID }}
|
||||||
|
OSS_ACCESS_KEY_SECRET: ${{ secrets.ALICLOUDOSS_KEY_SECRET }}
|
||||||
|
OSS_REGION: cn-beijing
|
||||||
|
OSS_ENDPOINT: https://oss-cn-beijing.aliyuncs.com
|
||||||
|
run: |
|
||||||
|
echo "::group::Creating latest.json file"
|
||||||
|
|
||||||
|
# Extract version from tag (remove 'refs/tags/' prefix)
|
||||||
|
VERSION="${GITHUB_REF#refs/tags/}"
|
||||||
|
# Remove 'v' prefix if present
|
||||||
|
VERSION="${VERSION#v}"
|
||||||
|
|
||||||
|
# Get current timestamp in ISO 8601 format
|
||||||
|
RELEASE_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
||||||
|
|
||||||
|
# Create latest.json content
|
||||||
|
cat > latest.json << EOF
|
||||||
|
{
|
||||||
|
"version": "${VERSION}",
|
||||||
|
"release_date": "${RELEASE_DATE}",
|
||||||
|
"release_notes": "Release ${VERSION}",
|
||||||
|
"download_url": "https://github.com/rustfs/rustfs/releases/tag/${GITHUB_REF#refs/tags/}"
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
echo "Generated latest.json:"
|
||||||
|
cat latest.json
|
||||||
|
|
||||||
|
echo "::group::Uploading latest.json to OSS"
|
||||||
|
# Upload latest.json to rustfs-version bucket
|
||||||
|
ossutil cp latest.json "oss://rustfs-version/latest.json" --force
|
||||||
|
echo "Successfully uploaded latest.json to OSS"
|
||||||
|
|
||||||
# Determine whether to perform GUI construction based on conditions
|
# Determine whether to perform GUI construction based on conditions
|
||||||
- name: Prepare for GUI build
|
- name: Prepare for GUI build
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
@@ -535,6 +573,7 @@ jobs:
|
|||||||
merge:
|
merge:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [build-rustfs]
|
needs: [build-rustfs]
|
||||||
|
# Only execute merge operation when tag is pushed
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/upload-artifact/merge@v4
|
- uses: actions/upload-artifact/merge@v4
|
||||||
|
|||||||
@@ -18,11 +18,47 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
paths-ignore:
|
||||||
|
- "**.md"
|
||||||
|
- "**.txt"
|
||||||
|
- "docs/**"
|
||||||
|
- "deploy/**"
|
||||||
|
- "scripts/dev_*.sh"
|
||||||
|
- "scripts/probe.sh"
|
||||||
|
- "LICENSE*"
|
||||||
|
- ".gitignore"
|
||||||
|
- ".dockerignore"
|
||||||
|
- "README*"
|
||||||
|
- "**/*.png"
|
||||||
|
- "**/*.jpg"
|
||||||
|
- "**/*.svg"
|
||||||
|
- ".github/workflows/build.yml"
|
||||||
|
- ".github/workflows/docker.yml"
|
||||||
|
- ".github/workflows/audit.yml"
|
||||||
|
- ".github/workflows/samply.yml"
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
paths-ignore:
|
||||||
|
- "**.md"
|
||||||
|
- "**.txt"
|
||||||
|
- "docs/**"
|
||||||
|
- "deploy/**"
|
||||||
|
- "scripts/dev_*.sh"
|
||||||
|
- "scripts/probe.sh"
|
||||||
|
- "LICENSE*"
|
||||||
|
- ".gitignore"
|
||||||
|
- ".dockerignore"
|
||||||
|
- "README*"
|
||||||
|
- "**/*.png"
|
||||||
|
- "**/*.jpg"
|
||||||
|
- "**/*.svg"
|
||||||
|
- ".github/workflows/build.yml"
|
||||||
|
- ".github/workflows/docker.yml"
|
||||||
|
- ".github/workflows/audit.yml"
|
||||||
|
- ".github/workflows/samply.yml"
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 0 * * 0' # at midnight of each sunday
|
- cron: "0 0 * * 0" # at midnight of each sunday
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -37,7 +73,7 @@ jobs:
|
|||||||
- id: skip_check
|
- id: skip_check
|
||||||
uses: fkirc/skip-duplicate-actions@v5
|
uses: fkirc/skip-duplicate-actions@v5
|
||||||
with:
|
with:
|
||||||
concurrent_skipping: 'same_content_newer'
|
concurrent_skipping: "same_content_newer"
|
||||||
cancel_others: true
|
cancel_others: true
|
||||||
paths_ignore: '["*.md"]'
|
paths_ignore: '["*.md"]'
|
||||||
|
|
||||||
|
|||||||
@@ -16,10 +16,10 @@ name: Build and Push Docker Images
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
tags:
|
tags:
|
||||||
- "v*"
|
- "v*"
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
@@ -28,7 +28,7 @@ on:
|
|||||||
push_to_registry:
|
push_to_registry:
|
||||||
description: "Push images to registry"
|
description: "Push images to registry"
|
||||||
required: false
|
required: false
|
||||||
default: "true"
|
default: true
|
||||||
type: boolean
|
type: boolean
|
||||||
|
|
||||||
env:
|
env:
|
||||||
@@ -55,7 +55,8 @@ jobs:
|
|||||||
# Build RustFS binary for different platforms
|
# Build RustFS binary for different platforms
|
||||||
build-binary:
|
build-binary:
|
||||||
needs: skip-check
|
needs: skip-check
|
||||||
if: needs.skip-check.outputs.should_skip != 'true'
|
# Only execute in the following cases: 1) tag push 2) commit message contains --build 3) workflow_dispatch 4) PR
|
||||||
|
if: needs.skip-check.outputs.should_skip != 'true' && (startsWith(github.ref, 'refs/tags/') || contains(github.event.head_commit.message, '--build') || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request')
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
|
|||||||
Reference in New Issue
Block a user