Skip to content

Commit

Permalink
master/release build modes
Browse files Browse the repository at this point in the history
  • Loading branch information
spvkgn committed Nov 13, 2024
1 parent 13b9015 commit 78a035f
Showing 1 changed file with 30 additions and 11 deletions.
41 changes: 30 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ name: build

on:
workflow_dispatch:
inputs:
build_mode:
description: 'Build mode'
required: true
default: 'master'
type: choice
options:
- master
- release
# schedule:
# - cron: '0 6 * * *'

Expand Down Expand Up @@ -36,6 +45,7 @@ jobs:
echo "DATE=$DATE" >> $GITHUB_ENV
- name: Check for repo activity
if: github.event_name != 'workflow_dispatch'
id: activity
env:
DATE: ${{ env.DATE }}
Expand All @@ -47,7 +57,7 @@ jobs:
echo "Commit: $URL"
if [ "${{ github.event_name }}" != "schedule" ]; then
is_active=true
elif [[ $DAYS -lt 1 ]] ; then
elif [[ $DAYS -lt 1 ]]; then
is_active=true
else
echo "Repository not updated within last 24 hours."
Expand All @@ -57,12 +67,14 @@ jobs:
build:
needs: check
if: needs.check.outputs.is_active == 'true'
if: github.event_name == 'workflow_dispatch' || needs.check.outputs.is_active == 'true'
name: "${{ matrix.branch }} :: ${{ matrix.arch }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
isRelease:
- ${{ inputs.build_mode == 'release' }}
branch:
# - openwrt-19.07
- openwrt-21.02
Expand Down Expand Up @@ -95,10 +107,8 @@ jobs:
- mipsel_74kc
- mipsel_mips32
- x86_64
include:
- branch: SNAPSHOT
arch: x86_64
exclude:
- isRelease: false
# - branch: openwrt-19.07
# arch: arm_cortex-a7
# - branch: openwrt-19.07
Expand All @@ -107,6 +117,11 @@ jobs:
# arch: mips_4kec
- branch: openwrt-21.02
arch: arm_cortex-a7_vfpv4
include:
- branch: SNAPSHOT
arch: x86_64
- branch: openwrt-21.02
arch: mipsel_24kc
container:
image: openwrt/sdk:${{ matrix.arch }}-${{ matrix.branch }}
options: --user root
Expand All @@ -115,7 +130,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: 'bol-van/zapret'
ref: ${{ needs.check.outputs.tag }}
ref: ${{ inputs.build_mode == 'release' && needs.check.outputs.tag || null }}
path: zapret

- name: Apply diff from PR
Expand All @@ -128,7 +143,7 @@ jobs:
cd zapret && ../gh pr diff 413 | git apply -
- name: Set up SDK
if: ${{ matrix.branch == 'openwrt-23.05' || matrix.branch == 'SNAPSHOT' }}
if: matrix.branch == 'openwrt-23.05' || matrix.branch == 'SNAPSHOT'
working-directory: /builder
shell: bash
run: |
Expand All @@ -151,17 +166,19 @@ jobs:
continue-on-error: true
working-directory: ${{ matrix.branch == 'openwrt-19.07' && '/home/build/openwrt' || '/builder' }}
env:
# DATE: ${{ needs.check.outputs.date }}
DATE: ${{ needs.check.outputs.date }}
TAG: ${{ needs.check.outputs.tag }}
# SHA: ${{ needs.check.outputs.sha }}
ARCH: ${{ matrix.arch }}
BRANCH: ${{ matrix.branch }}
SIGN_KEY: ${{ secrets.SIGN_PRIVATE_KEY }}
CCACHE_DIR: ${{ matrix.branch == 'openwrt-19.07' && '/home/build/openwrt/.ccache' || '/builder/.ccache' }}
shell: bash
run: |
# export PKG_VERSION=$(date --utc -d $DATE +%Y%m%d)
export PKG_VERSION=${TAG#v}
if [[ ${{ inputs.build_mode }} == 'release' ]]; then
export PKG_VERSION=${TAG#v}
else
export PKG_VERSION=${TAG#v}.$(date --utc -d $DATE +%Y%m%d)
fi
find $GITHUB_WORKSPACE/zapret -type d -path '*/package/zapret' -exec cp -vr {} ./package \;
cp -vr $GITHUB_WORKSPACE/zapret/tpws ./package/zapret/tpws/
Expand Down Expand Up @@ -211,6 +228,7 @@ jobs:
path: logs-*.tar.xz

gh-pages:
if: inputs.build_mode == 'release'
needs: [ check, build ]
permissions:
contents: write
Expand Down Expand Up @@ -240,6 +258,7 @@ jobs:
continue-on-error: true

release:
if: inputs.build_mode == 'release'
needs: [ check, gh-pages ]
permissions:
contents: write
Expand Down

0 comments on commit 78a035f

Please sign in to comment.