Skip to content

Commit

Permalink
chore: update file location and add workflow to automate builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Loukious committed Nov 23, 2024
1 parent 125e5d7 commit 6b0bb8a
Show file tree
Hide file tree
Showing 10 changed files with 111 additions and 48 deletions.
98 changes: 98 additions & 0 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
@@ -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 <<EOT > 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 "[email protected]"
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 }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/dist
/dist
/zygisk
/META-INF
16 changes: 0 additions & 16 deletions CHANGELOG.md

This file was deleted.

4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -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
29 changes: 0 additions & 29 deletions dist.sh

This file was deleted.

File renamed without changes.
2 changes: 0 additions & 2 deletions module/.gitignore

This file was deleted.

File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions update.json
Original file line number Diff line number Diff line change
@@ -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"
}

0 comments on commit 6b0bb8a

Please sign in to comment.