diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml new file mode 100644 index 0000000..6a8d890 --- /dev/null +++ b/.github/workflows/update.yml @@ -0,0 +1,98 @@ +name: Manual Update and Release + +on: + workflow_dispatch: + inputs: + version: + description: "The new version number (e.g., 1.1)" + required: true + +jobs: + update-and-release: + runs-on: ubuntu-latest + + steps: + # Step 1: Checkout Repository + - name: Checkout Repository + uses: actions/checkout@v4 + + # Step 2: Set Version Variables from Input + - name: Set Version Variables + id: set_version + run: | + version="${{ github.event.inputs.version }}" + version_code=$(echo $version | tr -d '.') # Generate version code from version number by removing dots + + echo "version=$version" >> $GITHUB_ENV + echo "version_code=$version_code" >> $GITHUB_ENV + + # Step 3: Create Necessary Directories and Download update-binary + - name: Create META-INF Directory and Download update-binary + run: | + META_INF_PATH="./META-INF/com/google/android" + mkdir -p "${META_INF_PATH}" + + # Download the update-binary script to the correct directory + curl -sSL "https://raw.githubusercontent.com/topjohnwu/Magisk/master/scripts/module_installer.sh" > "${META_INF_PATH}/update-binary" + + # Create an empty updater-script with #MAGISK header + echo "#MAGISK" > "${META_INF_PATH}/updater-script" + + # Step 4: Update Version Information in module.prop + - name: Update module.prop + run: | + sed -i "s/^version=.*/version=${{ env.version }}/" module.prop + sed -i "s/^versionCode=.*/versionCode=${{ env.version_code }}/" module.prop + + # Step 5: Update changelog.md with new version + - name: Update changelog.md + run: | + sed -i "5s/^/## v${{ env.version }}\n- Added updates for the new release.\n\n/" changelog.md + + # Step 6: Update update.json with new version details + - name: Update update.json + run: | + RELEASE_URL="https://github.com/Magisk-Modules-Alt-Repo/Custom-Certificate-Authorities/releases/download/${{ env.version }}/Custom_Certificate_Authorities_v${{ env.version }}.zip" + CHANGELOG_URL="https://raw.githubusercontent.com/Magisk-Modules-Alt-Repo/Custom-Certificate-Authorities/main/changelog.md" + + cat < update.json + { + "version": "${{ env.version }}", + "versionCode": ${{ env.version_code }}, + "zipUrl": "${RELEASE_URL}", + "changelog": "${CHANGELOG_URL}" + } + EOT + + # Step 7: Commit and Push Changes + - name: Commit and Push Changes + run: | + git config user.name "GitHub Actions" + git config user.email "actions@github.com" + git add module.prop changelog.md update.json + git commit -m "Update to version ${{ env.version }}" + git push + + # Step 8: Install zip Tool to Package Repository + - name: Install zip + run: sudo apt-get install -y zip + + # Step 9: Package Repository as Magisk Flashable ZIP + - name: Package Repository as Magisk Flashable ZIP + run: | + ZIP_FILENAME="Custom_Certificate_Authorities_v${{ env.version }}.zip" + mkdir -p ./dist + rm -f ./dist/${ZIP_FILENAME} + + zip -r ./dist/${ZIP_FILENAME} META-INF system post-fs-data.sh module.prop + + # Step 10: Create GitHub Release + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ env.version }} + release_name: Custom Certificate Authorities v${{ env.version }} + body: "Automated release of Custom Certificate Authorities v${{ env.version }}" + files: ./dist/Custom_Certificate_Authorities_v${{ env.version }}.zip + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 3e22129..cebd6b2 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -/dist \ No newline at end of file +/dist +/zygisk +/META-INF \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 49ab064..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,16 +0,0 @@ -# Changelog -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [1.1.0] - 2024-01-22 -### Fixed -- Added support for Android 14 (Thanks to @sfionov 's [PR](https://github.com/AdguardTeam/adguardcert/pull/53)) -- Added dist.sh script to help build the module - -## [1.0.1] - 2022-02-13 -### Fixed -- Ensure that custom certificates have the same properties as Android's built-in certificates - -## [1.0.0] - 2022-02-12 -- Initial release diff --git a/changelog.md b/changelog.md new file mode 100644 index 0000000..539ad4a --- /dev/null +++ b/changelog.md @@ -0,0 +1,4 @@ +## [1.1.0] - 2024-01-22 +### Fixed +- Added support for Android 14 (Thanks to @sfionov 's [PR](https://github.com/AdguardTeam/adguardcert/pull/53)) +- Added dist.sh script to help build the module \ No newline at end of file diff --git a/dist.sh b/dist.sh deleted file mode 100644 index 6b6dc5f..0000000 --- a/dist.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -UPDATE_BINARY_URL="https://raw.githubusercontent.com/topjohnwu/Magisk/master/scripts/module_installer.sh" - -mkdir -p ./module/META-INF/com/google/android -curl "${UPDATE_BINARY_URL}" > ./module/META-INF/com/google/android/update-binary -echo "#MAGISK" > ./module/META-INF/com/google/android/updater-script - -VERSION=$(sed -ne "s/version=\(.*\)/\1/gp" ./module/module.prop) -NAME=$(sed -ne "s/id=\(.*\)/\1/gp" ./module/module.prop) -ZIP_FILENAME="${NAME}-${VERSION}.zip" - -mkdir -p ./dist - -rm -f ./dist/${ZIP_FILENAME} -( - cd ./module - zip ../dist/${ZIP_FILENAME} -r * -x ".*" "*/.*" -) - -RELEASE_URL="https://github.com/Magisk-Modules-Alt-Repo/Custom-Certificate-Authorities/releases/download/${VERSION}/${ZIP_FILENAME}" -CHANGELOG_URL="https://raw.githubusercontent.com/Magisk-Modules-Alt-Repo/Custom-Certificate-Authorities/master/CHANGELOG.md" - -echo "{ - \"version\": \"${VERSION}\", - \"versionCode\": ${VERSION//[^0-9]/}, - \"zipUrl\": \"${RELEASE_URL}\", - \"changelog\": \"${CHANGELOG_URL}\" -}" > ./dist/updateJson.json diff --git a/module/module.prop b/module.prop similarity index 100% rename from module/module.prop rename to module.prop diff --git a/module/.gitignore b/module/.gitignore deleted file mode 100644 index 90233b6..0000000 --- a/module/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/zygisk -/META-INF diff --git a/module/post-fs-data.sh b/post-fs-data.sh similarity index 100% rename from module/post-fs-data.sh rename to post-fs-data.sh diff --git a/module/system/etc/security/cacerts/.gitkeep b/system/etc/security/cacerts/.gitkeep similarity index 100% rename from module/system/etc/security/cacerts/.gitkeep rename to system/etc/security/cacerts/.gitkeep diff --git a/update.json b/update.json new file mode 100644 index 0000000..038e2f9 --- /dev/null +++ b/update.json @@ -0,0 +1,6 @@ +{ + "version": "v1.1.0", + "versionCode": 110, + "zipUrl": "https://github.com/Magisk-Modules-Alt-Repo/Custom-Certificate-Authorities/releases/download/v1.1.0/Custom-Certificate-Authorities-v1.1.0.zip", + "changelog": "https://raw.githubusercontent.com/Magisk-Modules-Alt-Repo/Custom-Certificate-Authorities/main/changelog.md" +} \ No newline at end of file