This repository has been archived by the owner on Aug 15, 2024. It is now read-only.
Upload Release Asset #26
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
on: | |
workflow_dispatch: | |
push: | |
# Sequence of patterns matched against refs/tags | |
tags: | |
- '*' # Tag events | |
name: Upload Release Asset | |
jobs: | |
build: | |
name: Upload Release Asset | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout codes | |
uses: actions/checkout@v1 | |
- name: build | |
id: build_ipk | |
run: | | |
txt=$(cat applications/luci-app-cloudflarespeedtest/Makefile|tr '\n' ',') | |
version=`echo $txt|sed -r 's/.*PKG_VERSION:=(.*),PKG_RELEASE.*/\1/'` | |
echo "version=$version" >> $GITHUB_ENV | |
mkdir -p /tmp/luci-app-cloudflarespeedtest/usr/lib/lua/luci | |
[ -d $GITHUB_WORKSPACE/applications/luci-app-cloudflarespeedtest/luasrc ] && cp -R $GITHUB_WORKSPACE/applications/luci-app-cloudflarespeedtest/luasrc/* /tmp/luci-app-cloudflarespeedtest/usr/lib/lua/luci/ | |
[ -d $GITHUB_WORKSPACE/applications/luci-app-cloudflarespeedtest/root ] && cp -R $GITHUB_WORKSPACE/applications/luci-app-cloudflarespeedtest/root/* /tmp/luci-app-cloudflarespeedtest/ | |
chmod +x /tmp/luci-app-cloudflarespeedtest/etc/init.d/* >/dev/null 2>&1 | |
[ -d $GITHUB_WORKSPACE/applications/luci-app-cloudflarespeedtest/po ] && sudo -E apt-get -y install gcc make && \ | |
mkdir -p /tmp/po2lmo && mkdir -p /tmp/luci-app-cloudflarespeedtest/usr/lib/lua/luci/i18n/ && \ | |
wget -O /tmp/po2lmo/po2lmo.c https://raw.githubusercontent.com/openwrt/luci/openwrt-18.06/modules/luci-base/src/po2lmo.c && \ | |
wget -O /tmp/po2lmo/Makefile https://raw.githubusercontent.com/openwrt/luci/openwrt-18.06/modules/luci-base/src/Makefile && \ | |
wget -O /tmp/po2lmo/template_lmo.h https://raw.githubusercontent.com/openwrt/luci/openwrt-18.06/modules/luci-base/src/template_lmo.h && \ | |
wget -O /tmp/po2lmo/template_lmo.c https://raw.githubusercontent.com/openwrt/luci/openwrt-18.06/modules/luci-base/src/template_lmo.c && \ | |
cd /tmp/po2lmo && make po2lmo && ./po2lmo $GITHUB_WORKSPACE/applications/luci-app-cloudflarespeedtest/po/zh_Hans/cloudflarespeedtest.po /tmp/luci-app-cloudflarespeedtest/usr/lib/lua/luci/i18n/cloudflarespeedtest.zh-cn.lmo | |
mkdir -p /tmp/luci-app-cloudflarespeedtest/CONTROL | |
cat >/tmp/luci-app-cloudflarespeedtest/CONTROL/control <<EOF | |
Package: luci-app-cloudflarespeedtest | |
Version: ${version} | |
Depends: libc cdnspeedtest | |
Architecture: all | |
Maintainer: mingxiaoyu <[email protected]> | |
Section: luci | |
Priority: optional | |
Description: LuCI support for Cloudflares Speed Test | |
Source: http://github.com/mingxiaoyu/luci-app-cloudflarespeedtest | |
EOF | |
cat >/tmp/luci-app-cloudflarespeedtest/CONTROL/postinst <<EOF | |
#!/bin/sh | |
[ "${IPKG_NO_SCRIPT}" = "1" ] && exit 0 | |
[ -s ${IPKG_INSTROOT}/lib/functions.sh ] || exit 0 | |
. ${IPKG_INSTROOT}/lib/functions.sh | |
default_postinst \$0 \$@ | |
EOF | |
chmod +x /tmp/luci-app-cloudflarespeedtest/usr/bin/cloudflarespeedtest/*.sh | |
chmod +x /tmp/luci-app-cloudflarespeedtest/CONTROL/postinst | |
wget -O /tmp/ipkg-build https://raw.githubusercontent.com/openwrt/openwrt/openwrt-18.06/scripts/ipkg-build && \ | |
chmod +x /tmp/ipkg-build && \ | |
/tmp/ipkg-build -o root -g root /tmp/luci-app-cloudflarespeedtest /tmp | |
- name: Create Release | |
id: create_release | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ env.version }} | |
release_name: Release v${{ env.version }} | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: /tmp/luci-app-cloudflarespeedtest_${{ env.version }}_all.ipk | |
asset_name: luci-app-cloudflarespeedtest_${{ env.version }}_all.ipk | |
asset_content_type: application/octet-stream |