Skip to content

Release 2.0.13

Release 2.0.13 #40

Workflow file for this run

name: CI
on:
push:
branches:
- master
tags:
- 'release-*'
paths:
- 'luci-app-wrtbwmon/**'
pull_request:
branches:
- master
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true
jobs:
build:
name: Build the IPK
runs-on: ubuntu-latest
container:
image: ghcr.io/openwrt/sdk:x86-64-23.05-SNAPSHOT
options: --user root
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Docker Build
working-directory: /builder
run: |
sed \
-e 's,git\.openwrt\.org/feed/,github.com/openwrt/,' \
-e 's,git\.openwrt\.org/openwrt/,github.com/openwrt/,' \
-e 's,git\.openwrt\.org/project/,github.com/openwrt/,' \
feeds.conf.default | grep -Ev "^src-git(-full)? (routing|telephony) .*" > feeds.conf
echo "src-cpy local ${GITHUB_WORKSPACE}" >> feeds.conf
./scripts/feeds update -f luci local
./scripts/feeds install -p local luci-app-wrtbwmon
make defconfig
make package/luci-app-wrtbwmon/compile V=sc -j$(nproc) BUILD_LOG=1
tar -cJf logs.tar.xz logs
- name: Release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/release-')
uses: actions/github-script@v6
with:
script: |
const tag = context.ref.replace("refs/tags/", "");
try {
// Get release for this tag
const release = await github.rest.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag: tag,
});
// Delete obsolete release
await github.rest.repos.deleteRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.data.id,
});
}
catch(err) {
console.log(err);
}
finally {
// Create release for this tag
const release = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: tag,
draft: false,
prerelease: true,
});
// Upload the release asset
const fs = require('fs');
const patterns = ['/builder/bin/packages/x86_64/*/*wrtbwmon*.ipk']
const globber = await glob.create(patterns.join('\n'))
for await (const file of globber.globGenerator()) {
await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.data.id,
name: file.substr(file.lastIndexOf('/') + 1),
data: await fs.readFileSync(file)
});
}
}
- name: Upload app
if: ${{ ! (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/release-')) }}
uses: actions/upload-artifact@v3
with:
name: luci-app-wrtbwmon
path: /builder/bin/packages/x86_64/*/*wrtbwmon*
if-no-files-found: error
- name: Upload Log
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: buildlog
path: /builder/logs.tar.xz