Skip to content

release #98

release #98 #365

name: Build and Release
on:
push:
branches: [main, dev]
pull_request:
branches: [main]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
artifact_extension: tar.gz
- os: macos-latest
artifact_extension: zip
- os: windows-latest
artifact_extension: zip
steps:
- name: Checkout code
uses: actions/checkout@v4
# Ubuntu Section
- name: Install dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y ninja-build \
qt6-base-dev qt6-tools-dev qt6-tools-dev-tools \
qt6-l10n-tools libgl1-mesa-dev libglu1-mesa-dev rsync
- name: Configure CMake (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
cmake -B "${{ github.workspace }}/build" \
-DCMAKE_BUILD_TYPE=Release \
-G "Ninja" \
-S "${{ github.workspace }}"
- name: Build Notepad-- (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: cmake --build "${{ github.workspace }}/build" --config Release
- name: Package Notepad-- (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
mkdir -p artifacts
tar -czvf artifacts/Notepad--_ubuntu.tar.gz -C "${{ github.workspace }}/build" .
echo "Packaging completed. Listing artifacts directory:"
ls -al artifacts
- name: Upload Ubuntu Artifact
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v3
with:
name: Notepad--_ubuntu
path: artifacts/Notepad--_ubuntu.tar.gz
# macOS Section (unchanged for brevity)
# Windows Section (unchanged for brevity)
release:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Generate Tag Name
id: tag_name
run: |
TIMESTAMP=$(date +%Y%m%d%H%M%S)
echo "RELEASE_TAG=release-$TIMESTAMP" >> $GITHUB_ENV
echo "::set-output name=tag_name::release-$TIMESTAMP"
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.RELEASE_TAG }}
release_name: Notepad-- Release
draft: false
prerelease: false
- name: Upload Ubuntu Artifact to Release
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/Notepad--_ubuntu.tar.gz
asset_name: Notepad--_ubuntu.tar.gz
asset_content_type: application/gzip