Skip to content

add AppCounts

add AppCounts #238

name: Create Release
permissions:
contents: write
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Delete tag and release
uses: dev-drprasad/delete-tag-and-release@v1.0
with:
tag_name: new
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Filter and Create Release
id: create_release
run: |
# Build universal
zip AppStore.zip $(find . -type f \( -wholename "./*.json" -o -wholename "./Apps/*.yml" \))
universal_count=$(find ./Apps/ -name "*.yml" | wc -l)
# Build arm
[ -d "./Apps_arm" ] && cp -rfu ./Apps_arm/* ./Apps/
zip AppStore_arm.zip $(find . -type f -wholename "./*.json" && find . -type f -wholename "./Apps/*.yml" -exec grep -rlPz 'x-casaos:\s*\n\s*architectures:[\n\s\w-]*- arm\s*\n' {} \;)
arm_count=$(find ./Apps/ -name "*.yml" | wc -l)
git checkout -- ./Apps && git clean -df ./Apps
# Build arm64
[ -d "./Apps_arm64" ] && cp -rfu ./Apps_arm64/* ./Apps/
zip AppStore_arm64.zip $(find . -type f -wholename "./*.json" && find . -type f -wholename "./Apps/*.yml" -exec grep -rlPz 'x-casaos:\s*\n\s*architectures:[\n\s\w-]*- arm64\s*\n' {} \;)
arm64_count=$(find ./Apps/ -name "*.yml" | wc -l)
git checkout -- ./Apps && git clean -df ./Apps
# Build amd64
[ -d "./Apps_amd64" ] && cp -rfu ./Apps_amd64/* ./Apps/
zip AppStore_amd64.zip $(find . -type f -wholename "./*.json" && find . -type f -wholename "./Apps/*.yml" -exec grep -rlPz 'x-casaos:\s*\n\s*architectures:[\n\s\w-]*- amd64\s*\n' {} \;)
amd64_count=$(find ./Apps/ -name "*.yml" | wc -l)
echo "::set-output name=app_counts::universal: $universal_count, arm: $arm_count, arm64: $arm64_count, amd64: $amd64_count"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get Commit Messages
id: get_commit_messages
run: |
echo "::set-output name=commits::$(git log --pretty=format:'- %s (%h)' --no-merges)"
- name: Upload New Release
uses: softprops/action-gh-release@v2
with:
files: |
AppStore.zip
AppStore_arm.zip
AppStore_arm64.zip
AppStore_amd64.zip
tag_name: new
draft: false
prerelease: false
body: "## What's Changed\n\n${{ steps.get_commit_messages.outputs.commits }}\n\n📊 **App Counts:**\n${{ steps.create_release.outputs.app_counts }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload to OSS
id: upload_to_oss
uses: tvrcgo/upload-to-oss@master
with:
key-id: ${{ secrets.OSS_KEY_ID }}
key-secret: ${{ secrets.OSS_KEY_SECRET }}
endpoint: ${{ secrets.OSS_ENDPOINT }}
bucket: ${{ secrets.OSS_BUCKET }}
assets: |
AppStore.zip:Cp0204-AppStore-Play.zip
AppStore_arm.zip:Cp0204-AppStore-Play-arm.zip
AppStore_arm64.zip:Cp0204-AppStore-Play-arm64.zip
AppStore_amd64.zip:Cp0204-AppStore-Play-amd64.zip