mirror of
https://github.com/egor-white/zaprett.git
synced 2026-03-22 00:18:13 +05:00
114 lines
3.5 KiB
YAML
114 lines
3.5 KiB
YAML
name: Build module (without post)
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
create_release:
|
|
description: 'Create GitHub release?'
|
|
required: false
|
|
default: 'false'
|
|
tag:
|
|
description: "Tag for the release (x.x.x)"
|
|
required: true
|
|
type: string
|
|
nfqws-version:
|
|
description: "Nfqws version (x.x)"
|
|
required: true
|
|
type: string
|
|
nfqws2-version:
|
|
description: "Nfqws2 version (x.x)"
|
|
required: true
|
|
type: string
|
|
version:
|
|
description: "Module version (x.x)"
|
|
required: true
|
|
type: string
|
|
version_code:
|
|
description: "Module version code (xx)"
|
|
required: true
|
|
type: string
|
|
release_name:
|
|
description: "Release Name"
|
|
required: true
|
|
type: string
|
|
release_changes:
|
|
description: "Release Changes"
|
|
required: true
|
|
type: string
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
NFQWS_VERSION: ${{ inputs.nfqws-version }}
|
|
NFQWS2_VERSION: ${{ inputs.nfqws2-version }}
|
|
MODULE_VERSION: ${{ inputs.version }}
|
|
MODULE_VERSION_CODE: ${{ inputs.version_code }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup Git submodules
|
|
run: git submodule update --init --recursive
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo dpkg --add-architecture i386
|
|
sudo apt update
|
|
sudo apt install -y build-essential pkg-config just unzip libc6-dev-i386 gcc-multilib
|
|
|
|
- name: Make executable
|
|
run: chmod +x build-module.sh
|
|
|
|
- name: Build module
|
|
run: ./build-module.sh
|
|
|
|
- name: Create release
|
|
if: ${{ inputs.create_release == 'true' }}
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ inputs.tag }}
|
|
name: ${{ inputs.release_name }}
|
|
body: ${{ inputs.release_changes }}
|
|
files: out/*
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Upload artifact
|
|
if: ${{ inputs.create_release != 'true' }}
|
|
uses: actions/upload-artifact@v5.0.0
|
|
with:
|
|
name: zaprett
|
|
path: out/*
|
|
|
|
- name: Update changelog
|
|
if: ${{ inputs.create_release == 'true' }}
|
|
run: echo "${{ inputs.release_changes }}" > changelog.md
|
|
|
|
- name: Update update.json
|
|
if: ${{ inputs.create_release == 'true' }}
|
|
run: |
|
|
cat > update.json <<EOF
|
|
{
|
|
"version": "${{ inputs.version }}",
|
|
"versionCode": ${{ inputs.version_code }},
|
|
"zipUrl": "https://github.com/${{ github.repository }}/releases/download/${{ inputs.tag }}/zaprett.zip",
|
|
"changelog": "https://raw.githubusercontent.com/${{ github.repository }}/refs/heads/main/changelog.md"
|
|
}
|
|
EOF
|
|
cat > update_hosts.json <<EOF
|
|
{
|
|
"version": "${{ inputs.version }}",
|
|
"versionCode": ${{ inputs.version_code }},
|
|
"zipUrl": "https://github.com/${{ github.repository }}/releases/download/${{ inputs.tag }}/zaprett-hosts.zip",
|
|
"changelog": "https://raw.githubusercontent.com/${{ github.repository }}/refs/heads/main/changelog.md"
|
|
}
|
|
EOF
|
|
|
|
- name: Commit jsons and changelog
|
|
if: ${{ inputs.create_release == 'true' }}
|
|
uses: stefanzweifel/git-auto-commit-action@v5
|
|
with:
|
|
commit_message: "Update update's.json and changelog"
|
|
file_pattern: "update.json update_hosts.json changelog.md"
|
|
|