-
Notifications
You must be signed in to change notification settings - Fork 494
121 lines (103 loc) · 5.17 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#=================================================
# https://github.com/wukongdaily/RunFilesBuilder
# Description: Build RunFiles using GitHub Actions
# Lisence: MIT
# Author: wukongdaily
# Blog: wkdaily.cpolar.top
#=================================================
name: Make Passwall run files
on:
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](https://img.shields.io/badge/Passwall.run-123456?logo=github&logoColor=fff&labelColor=green&style=for-the-badge) [![Github](https://img.shields.io/badge/国内加速站下载-FC7C0D?logo=github&logoColor=fff&labelColor=000&style=for-the-badge)](https://wkdaily.cpolar.top/archives/1) ![GitHub Downloads (all assets, specific tag)](https://img.shields.io/github/downloads/wukongdaily/RunFilesBuilder/${{ env.LATEST_TAG }}/total?style=for-the-badge&labelColor=black&color=%2325c2a0)"
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/[email protected]
with:
tag_name: ${{ env.LATEST_TAG }}
name: "PassWall-${{ env.LATEST_TAG }}"
files: makeself/passwall_*.run
token: ${{ secrets.GITHUB_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}