From bee27b3e97f73e1ab53fb6f4449c338af82269ea Mon Sep 17 00:00:00 2001 From: nyyu Date: Mon, 22 Aug 2022 17:51:08 +0200 Subject: [PATCH] add changelog --- .drone.yml | 11 ++++++----- sync.sh | 31 +++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 sync.sh diff --git a/.drone.yml b/.drone.yml index f4f0420..83c8d2f 100644 --- a/.drone.yml +++ b/.drone.yml @@ -16,7 +16,7 @@ steps: - repo init -u https://github.com/LineageOS/android.git -b lineage-$version - mkdir -p .repo/local_manifests - cp $DRONE_WORKSPACE_BASE/$device.xml .repo/local_manifests/roomservice.xml - - repo sync -q -c -j 6 --fail-fast --force-sync --no-tags + - bash $DRONE_WORKSPACE_BASE/sync.sh volumes: - name: build path: /build @@ -35,6 +35,7 @@ steps: commands: - rm -f /http/lineage-$version-*-UNOFFICIAL-$device.zip* - mv -f /build/out/target/product/$device/lineage-$version-*-UNOFFICIAL-$device.zip* /http/ + - cat /build/changelog_${device}_${version}.md >> /http/changelog_${device}_${version}.md - ls -lh /http/lineage-$version-*-UNOFFICIAL-$device.zip* volumes: - name: build @@ -45,8 +46,8 @@ steps: pull: always image: docker.nyyu.dev/lineage/android:latest commands: - - cd /build - - rm -f out/target/product/$device/lineage-$version-*-UNOFFICIAL-$device.zip_* out/target/product/$device/lineage_$device-ota-eng.*.zip + - rm -f /build/out/target/product/$device/lineage-$version-*-UNOFFICIAL-$device.zip_* /build/out/target/product/$device/lineage_$device-ota-eng.*.zip + - rm -f /build/changelog_${device}_${version}.md volumes: - name: build path: /build @@ -82,8 +83,8 @@ steps: pull: always image: docker.nyyu.dev/lineage/android:latest commands: - - cd /http - - mv lineage-$version-*-UNOFFICIAL-$device.zip* /publish/$version/$device/ + - mv /http/lineage-$version-*-UNOFFICIAL-$device.zip* /publish/$version/$device/ + - cat /http/changelog_${device}_${version}.md >> /publish/$version/$device/changelog.md - ls -lh /publish/$version/$device/ volumes: - name: http diff --git a/sync.sh b/sync.sh new file mode 100644 index 0000000..46b326b --- /dev/null +++ b/sync.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +TOPDIR=$(pwd) +changelog=${TOPDIR}/changelog_${device}_${version}.md + +declare -A before +tmp=($(repo forall -c 'echo "${REPO_PATH}:$(git rev-parse HEAD)"')) +for i in "${tmp[@]}"; do + IFS=: read -r folder commit <<<"${i}" + before[${folder}]=${commit} +done + +repo sync -q -c -j 6 --fail-fast --force-sync --no-tags + +echo -e "# Build $(date '+%Y-%m-%d %H:%M:%S') UTC\n" >>"${changelog}" + +tmp=($(repo forall -c 'echo "${REPO_PATH}:$(git rev-parse HEAD)"')) +for i in "${tmp[@]}"; do + IFS=: read -r folder commit <<<"${i}" + if [[ "${before[${folder}]}" != "${commit}" ]]; then + cd ${folder} + { + echo "## ${folder}" + git --no-pager log --pretty=format:"- %s" "${before[${folder}]}".."${commit}" + echo + } >>"${changelog}" + cd ${TOPDIR} + fi +done +echo -e "\n" >>"${changelog}" +cat "${changelog}"