mirror of
https://github.com/fankes/komari-theme-purcarte.git
synced 2025-10-19 03:49:22 +08:00
fix: 尝试修复 build 流程
This commit is contained in:
49
.github/workflows/build.yaml
vendored
49
.github/workflows/build.yaml
vendored
@@ -5,8 +5,6 @@ on:
|
|||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- "v*"
|
- "v*"
|
||||||
release:
|
|
||||||
types: [created]
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-package:
|
build-and-package:
|
||||||
@@ -37,22 +35,6 @@ jobs:
|
|||||||
|
|
||||||
- name: Update theme configuration
|
- name: Update theme configuration
|
||||||
run: |
|
run: |
|
||||||
# Get current date in YY.MM.DD format
|
|
||||||
VERSION_DATE=$(date +"%y.%m.%d")
|
|
||||||
# Get commit hash (short)
|
|
||||||
COMMIT_HASH=$(git rev-parse --short HEAD)
|
|
||||||
|
|
||||||
echo "VERSION_DATE=${VERSION_DATE}" >> $GITHUB_ENV
|
|
||||||
echo "COMMIT_HASH=${COMMIT_HASH}" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
# Update komari-theme.json with new version and description
|
|
||||||
jq --arg version "$VERSION_DATE" \
|
|
||||||
--arg desc "Theme for Komari Monitor (commit: $COMMIT_HASH)" \
|
|
||||||
'.version = $version | .description = $desc' \
|
|
||||||
komari-theme.json > komari-theme-updated.json
|
|
||||||
|
|
||||||
mv komari-theme-updated.json komari-theme.json
|
|
||||||
|
|
||||||
echo "Updated theme configuration:"
|
echo "Updated theme configuration:"
|
||||||
cat komari-theme.json
|
cat komari-theme.json
|
||||||
|
|
||||||
@@ -75,7 +57,7 @@ jobs:
|
|||||||
cp -r dist/ theme-package/
|
cp -r dist/ theme-package/
|
||||||
|
|
||||||
# Create zip file with version and commit hash
|
# Create zip file with version and commit hash
|
||||||
ZIP_NAME="komari-theme-purcarte-v${VERSION_DATE}-${COMMIT_HASH}.zip"
|
ZIP_NAME="komari-theme-purcarte.zip"
|
||||||
|
|
||||||
cd theme-package
|
cd theme-package
|
||||||
zip -r ../${ZIP_NAME} .
|
zip -r ../${ZIP_NAME} .
|
||||||
@@ -85,23 +67,30 @@ jobs:
|
|||||||
echo "Created package: ${ZIP_NAME}"
|
echo "Created package: ${ZIP_NAME}"
|
||||||
ls -la ${ZIP_NAME}
|
ls -la ${ZIP_NAME}
|
||||||
|
|
||||||
create-release:
|
- name: Upload Artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: theme-package
|
||||||
|
path: ${{ env.ZIP_NAME }}
|
||||||
|
retention-days: 1
|
||||||
|
|
||||||
|
create-release-on-tag-push:
|
||||||
needs: build-and-package
|
needs: build-and-package
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: startsWith(github.ref, 'refs/tags/v')
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Download artifact
|
- name: Download artifact
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: theme-package
|
name: theme-package
|
||||||
path: .
|
path: .
|
||||||
|
- name: Get Asset Name
|
||||||
- name: Display structure of downloaded files
|
id: get_asset_name
|
||||||
run: ls -R
|
run: |
|
||||||
|
ASSET_NAME=$(ls *.zip)
|
||||||
|
echo "ASSET_NAME=${ASSET_NAME}" >> $GITHUB_ENV
|
||||||
- name: Create Release
|
- name: Create Release
|
||||||
id: create_release
|
id: create_release
|
||||||
uses: actions/create-release@v1
|
uses: actions/create-release@v1
|
||||||
@@ -110,17 +99,15 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
tag_name: ${{ github.ref }}
|
tag_name: ${{ github.ref }}
|
||||||
release_name: Release ${{ github.ref_name }}
|
release_name: Release ${{ github.ref_name }}
|
||||||
body: |
|
body: "Automated release for tag ${{ github.ref_name }}"
|
||||||
New release based on commit ${{ env.COMMIT_HASH }}
|
|
||||||
draft: false
|
draft: false
|
||||||
prerelease: false
|
prerelease: false
|
||||||
|
|
||||||
- name: Upload Release Asset
|
- name: Upload Release Asset
|
||||||
uses: actions/upload-release-asset@v1
|
uses: actions/upload-release-asset@v1
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
asset_path: ./${{ env.ZIP_NAME }}
|
asset_path: ./${{ env.ASSET_NAME }}
|
||||||
asset_name: ${{ env.ZIP_NAME }}
|
asset_name: ${{ env.ASSET_NAME }}
|
||||||
asset_content_type: application/zip
|
asset_content_type: application/zip
|
||||||
|
Reference in New Issue
Block a user