release #1230
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
name: release | |
on: | |
schedule: | |
- cron: "0 4 * * *" | |
workflow_dispatch: | |
inputs: | |
nightly: | |
description: Nightly build | |
type: boolean | |
default: false | |
debug: | |
description: Debug symbols | |
type: boolean | |
default: false | |
tag: | |
description: Optional release tag (normally auto-detected) | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ubuntu-20.04, windows-2019, macOS-11] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Checkout textadept-build dependencies | |
uses: actions/checkout@v3 | |
with: | |
repository: orbitalquark/textadept-build | |
path: textadept-build | |
- name: Install Qt (Windows, macOS) | |
uses: jurplel/install-qt-action@v3 | |
with: | |
version: '6.5' | |
modules: 'qt5compat' | |
if: "!startsWith(matrix.os, 'ubuntu')" | |
- name: Install Qt and GTK (Linux) | |
shell: bash | |
run: sudo apt-get install qtbase5-dev libgtk-3-dev --no-install-recommends -y | |
if: startsWith(matrix.os, 'ubuntu') | |
- name: Build | |
shell: bash | |
run: | | |
# Move cached dependencies into build/_deps. | |
mkdir -p build/_deps && mv textadept-build/* build/_deps && rm -r textadept-build | |
# Build. | |
type="Release" | |
if [[ ${{ github.event_name }} != schedule ]]; then | |
if [[ "${{ github.event.inputs.nightly }}" = true ]]; then nightly="-D NIGHTLY=1"; fi | |
if [[ "${{ github.event.inputs.debug }}" = true ]]; then type="Debug"; fi | |
else | |
nightly="-D NIGHTLY=1" | |
fi | |
cmake -S . -B build ${nightly} -D CMAKE_INSTALL_PREFIX=build/install | |
cmake --build build --config ${type} -j | |
cmake --install build --config ${type} | |
env: | |
VCINSTALLDIR: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: artifacts | |
path: | | |
build/*.tgz | |
build/*.zip | |
release: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup | |
shell: bash | |
run: sudo apt-get install -y lua5.3 discount | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: artifacts | |
- name: Determine version | |
id: version | |
shell: bash | |
run: | | |
version="${{ github.event.inputs.tag }}" | |
if [[ -z "$version" ]]; then | |
version=`ls -1 *.zip | head -1 | sed 's/[^_]\+_\(.\+\)\.[^.]\+\.zip/\1/;'` | |
fi | |
echo "version=$version" >> $GITHUB_OUTPUT | |
- name: Add HTML documentation | |
shell: bash | |
run: | | |
# Generate HTML documentation. | |
rm docs/*.html | |
pushd docs | |
for file in `ls *.md`; do | |
cat _layouts/default.html | ../scripts/fill_layout.lua $file > `basename -s .md $file`.html | |
done | |
popd | |
# Insert it into Windows and Linux archives. | |
mkdir -p textadept/docs | |
cp docs/*.html textadept/docs | |
version=${{steps.version.outputs.version}} | |
if [[ -f textadept_$version.win.zip ]]; then | |
zip -r textadept_$version.win.zip textadept/docs/*.html | |
fi | |
if [[ -f textadept_$version.linux.tar.gz ]]; then | |
gunzip textadept_$version.linux.tar.gz | |
tar --append -f textadept_$version.linux.tar textadept/docs/*.html | |
gzip textadept_$version.linux.tar | |
mv textadept_$version.linux.tar.gz textadept_$version.linux.tgz | |
fi | |
# Install it into macOS archive. | |
mkdir -p Textadept.app/Contents/Resources/docs | |
cp docs/*.html Textadept.app/Contents/Resources/docs | |
if [[ -f textadept_$version.macOS.zip ]]; then | |
zip -r textadept_$version.macOS.zip Textadept.app/Contents/Resources/docs/*.html | |
fi | |
- name: Package modules | |
shell: bash | |
run: | | |
mkdir textadept-modules | |
modules="debugger export file_diff format lsp lua_repl open_file_mode spellcheck" | |
for module in $modules; do | |
gh_name="`echo -n $module | sed -e 's/_/-/g;'`" | |
gh_prefix="https://github.com/orbitalquark/textadept-$gh_name" | |
wget $gh_prefix/releases/download/latest/$module.zip | |
unzip -d textadept-modules $module.zip | |
done | |
zip -r textadept_${{steps.version.outputs.version}}.modules.zip textadept-modules | |
- name: Tag | |
run: | | |
git tag textadept_${{ steps.version.outputs.version }} | |
git push -f origin textadept_${{ steps.version.outputs.version }} | |
- name: Create release log | |
shell: bash | |
run: | | |
echo -n "Textadept " > log.md | |
echo -n "${{ steps.version.outputs.version }} " | tr '_' ' ' >> log.md | |
echo \(`date +"%d %b %Y"`\) >> log.md | |
if [[ ${{ steps.version.outputs.version }} = nightly ]]; then exit 0; fi | |
prefix="https://orbitalquark.github.io/textadept" | |
echoing=0 | |
while read line; do | |
if [[ $line == \#\#\#* ]]; then | |
if [[ $echoing -eq 0 ]]; then | |
echoing=1 | |
else | |
exit 0 | |
fi | |
elif [[ $echoing -eq 1 ]]; then | |
echo "$line" | sed "s,\(manual\|api\)\.html,$prefix/\0,;" | |
fi | |
done < docs/changelog.md >> log.md | |
- name: Create release | |
uses: ncipollo/release-action@v1 | |
with: | |
name: ${{ steps.version.outputs.version }} | |
tag: textadept_${{ steps.version.outputs.version }} | |
prerelease: | | |
${{ steps.version.outputs.version == 'nightly' || | |
contains(steps.version.outputs.version, 'alpha') || | |
contains(steps.version.outputs.version, 'beta') }} | |
allowUpdates: true | |
bodyFile: log.md | |
artifacts: textadept_* | |
token: ${{ secrets.GITHUB_TOKEN }} |