-
Notifications
You must be signed in to change notification settings - Fork 601
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9575f9c
commit 1ec2c8b
Showing
1 changed file
with
115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
name: Make Passwall Run Package | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Fetch latest release tag from Passwall | ||
id: fetch_latest_tag | ||
run: | | ||
latest_tag=$(curl -s https://api.github.com/repos/xiaorouji/openwrt-passwall/releases/latest | jq -r '.tag_name') | ||
echo "LATEST_TAG=$latest_tag" >> $GITHUB_ENV | ||
- name: Clone makeself repository | ||
run: git clone https://github.com/megastep/makeself.git | ||
|
||
- name: Download latest Passwall files | ||
run: | | ||
mkdir -p downloads | ||
cd downloads | ||
curl -LO $(curl -s https://api.github.com/repos/xiaorouji/openwrt-passwall/releases/latest | grep -oP '"browser_download_url":\s*".*passwall_packages_ipk_x86_64.zip"' | cut -d '"' -f 4) | ||
curl -LO $(curl -s https://api.github.com/repos/xiaorouji/openwrt-passwall/releases/latest | grep -oP '"browser_download_url":\s*".*passwall_packages_ipk_aarch64_cortex-a53.zip"' | cut -d '"' -f 4) | ||
curl -LO $(curl -s https://api.github.com/repos/xiaorouji/openwrt-passwall/releases/latest | grep -oP '"browser_download_url":\s*".*luci-19.07.*\.ipk"' | head -1 | cut -d '"' -f 4) | ||
curl -LO $(curl -s https://api.github.com/repos/xiaorouji/openwrt-passwall/releases/latest | grep -oP '"browser_download_url":\s*".*luci-19.07.*\.ipk"' | tail -1 | cut -d '"' -f 4) | ||
- name: Organize files for x86_64 | ||
run: | | ||
mkdir -p passwall_x86_64/depends passwall_x86_64/main | ||
unzip downloads/passwall_packages_ipk_x86_64.zip -d passwall_x86_64/depends | ||
rm downloads/passwall_packages_ipk_x86_64.zip | ||
cp downloads/luci-19.07*.ipk passwall_x86_64/main/ | ||
- name: Organize files for aarch64_cortex-a53 | ||
run: | | ||
mkdir -p passwall_aarch64/depends passwall_aarch64/main | ||
unzip downloads/passwall_packages_ipk_aarch64_cortex-a53.zip -d passwall_aarch64/depends | ||
rm downloads/passwall_packages_ipk_aarch64_cortex-a53.zip | ||
cp downloads/luci-19.07*.ipk passwall_aarch64/main/ | ||
- name: Create install.sh scripts | ||
run: | | ||
cat <<EOF > passwall_x86_64/install.sh | ||
#!/bin/sh | ||
opkg update | ||
if [ $? -ne 0 ]; then | ||
echo "update failed。" | ||
exit 1 | ||
fi | ||
opkg install depends/*.ipk | ||
opkg install main/*.ipk | ||
EOF | ||
chmod +x passwall_x86_64/install.sh | ||
cp passwall_x86_64/install.sh passwall_aarch64/install.sh | ||
- name: Move passwall directories to makeself | ||
run: | | ||
mv passwall_x86_64 makeself/ | ||
mv passwall_aarch64 makeself/ | ||
- name: Create self-extracting packages | ||
run: | | ||
cd makeself | ||
./makeself.sh passwall_x86_64/ passwall_x86_64_${{ env.LATEST_TAG }}.run "by github action" ./install.sh | ||
./makeself.sh passwall_aarch64/ passwall_aarch64_a53_${{ env.LATEST_TAG }}.run "by github action" ./install.sh | ||
- name: Check file sizes | ||
run: | | ||
ls -lh makeself/passwall_*.run | ||
- name: Preparing release name | ||
run: | | ||
release_name=$(TZ="Asia/Shanghai" date +'%Y-%m-%d %H:%M Build') | ||
echo "RELEASE_NAME=$release_name" >> $GITHUB_ENV | ||
- name: Fetch latest release details | ||
id: fetch_release_details | ||
run: | | ||
extra_content="![GitHub Release](https://img.shields.io/github/v/release/wukongdaily/RunFilesBuilder?style=for-the-badge&logoSize=amg&labelColor=%23FFBF00&color=%2300C598)" | ||
release_notes=$(curl -s https://api.github.com/repos/xiaorouji/openwrt-passwall/releases/latest | jq -r '.body') | ||
if [ -z "$release_notes" ]; then | ||
release_notes="No release notes available." | ||
fi | ||
echo -e "$extra_content\n\n$release_notes" > release_notes.md | ||
- name: Print release notes | ||
run: | | ||
cat release_notes.md | ||
- name: Generate new tag & release | ||
uses: softprops/action-gh-release@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ env.LATEST_TAG }} | ||
target_commitish: ${{ github.ref_name }} | ||
prerelease: false | ||
body_path: release_notes.md | ||
|
||
- name: Upload run files as release assets | ||
uses: softprops/action-gh-release@v2.1.0 | ||
with: | ||
tag_name: ${{ env.LATEST_TAG }} | ||
files: makeself/passwall_*.run | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |