diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 4e6bbd1..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,238 +0,0 @@ -# SPDX-FileCopyrightText: 2025 William Bell -# -# SPDX-License-Identifier: GPL-3.0-or-later - -name: Build and Release - -on: - push: - tags: - - '*' # Any tag - -jobs: - build-linux-x86_64: - runs-on: ubuntu-latest # build both architectures - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Install build tools - run: sudo apt-get update && sudo apt-get install -y flex bison - - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: '3.x' - - - name: Install Conan - run: | - python -m pip install --upgrade pip - pip install conan - conan profile detect - - - name: Build - run: | - conan install . --build=missing - conan build . - - - name: Package - run: | - TAG=${GITHUB_REF##refs/tags/} - OS=$(uname -s | tr '[:upper:]' '[:lower:]') - ARCH=$(uname -m) - FOLDER="chloride-$TAG-$OS-$ARCH" - TAR="$FOLDER.tar.gz" - mv build/bin "$FOLDER" - cp LICENSE.txt "$FOLDER" - tar -czf "$TAR" "$FOLDER" - echo "TAR_NAME=$TAR" >> $GITHUB_ENV - - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: linux-x86_64-artifact - path: ${{ env.TAR_NAME }} - build-linux-arm64: - runs-on: ubuntu-22.04-arm # build both architectures - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Install build tools - run: sudo apt-get update && sudo apt-get install -y flex bison - - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: '3.x' - - - name: Install Conan - run: | - python -m pip install --upgrade pip - pip install conan - conan profile detect - - - name: Build - run: | - conan install . --build=missing - conan build . - - - name: Package - run: | - TAG=${GITHUB_REF##refs/tags/} - OS=$(uname -s | tr '[:upper:]' '[:lower:]') - ARCH=$(uname -m) - FOLDER="chloride-$TAG-$OS-$ARCH" - TAR="$FOLDER.tar.gz" - mv build/bin "$FOLDER" - cp LICENSE.txt "$FOLDER" - tar -czf "$TAR" "$FOLDER" - echo "TAR_NAME=$TAR" >> $GITHUB_ENV - - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: linux-arm64-artifact - path: ${{ env.TAR_NAME }} - - build-macos: - runs-on: macos-latest - strategy: - matrix: - arch: [x86_64, arm64] # build both architectures - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - - - name: Install build tools - run: brew install flex bison - - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: '3.x' - - - name: Install Conan - run: | - python -m pip install --upgrade pip - pip install conan - if [ "${{ matrix.arch }}" = "x86_64" ] && [ "$(uname -m)" = "arm64" ]; then - arch -x86_64 conan profile detect - else - conan profile detect - fi - - - name: Build - run: | - BUILD_DIR="build_${{ matrix.arch }}" - mkdir -p "$BUILD_DIR" - cd "$BUILD_DIR" - - # Use Rosetta for x86_64 builds on Apple Silicon - if [ "${{ matrix.arch }}" = "x86_64" ] && [ "$(uname -m)" = "arm64" ]; then - arch -x86_64 bash -c " - export CMAKE_OSX_ARCHITECTURES=x86_64 - conan install .. --build=missing - conan build .. - " - else - export CMAKE_OSX_ARCHITECTURES="${{ matrix.arch }}" - conan install .. --build=missing - conan build .. - fi - - cd .. - - - name: Package - run: | - TAG=${GITHUB_REF##refs/tags/} - OS="macos" - ARCH="${{ matrix.arch }}" - FOLDER="chloride-$TAG-$OS-$ARCH" - TAR="$FOLDER.tar.gz" - mv build/bin "$FOLDER" - cp LICENSE.txt "$FOLDER" - tar -czf "$TAR" "$FOLDER" - echo "TAR_NAME=$TAR" >> $GITHUB_ENV - - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: macos-${{ matrix.arch }}-artifact - path: ${{ env.TAR_NAME }} - - build-windows: - runs-on: windows-latest - defaults: - run: - shell: msys2 {0} - - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - - - uses: msys2/setup-msys2@v2 - with: - msystem: MINGW64 - update: true - install: > - base-devel - mingw-w64-x86_64-gcc - mingw-w64-x86_64-make - mingw-w64-x86_64-cmake - mingw-w64-x86_64-python - mingw-w64-x86_64-python-pip - msys/flex - - - name: Install Conan - run: | - python -m pip install --upgrade pip - pip install conan - conan profile detect - - - name: Build Project - run: | - conan install . --profile windows-profile.txt --build=missing - conan build . --profile windows-profile.txt - - - name: Package - run: | - TAG=${GITHUB_REF##refs/tags/} - OS="windows" - ARCH=$(uname -m) - FOLDER="chloride-$TAG-$OS-$ARCH" - TAR="$FOLDER.tar.gz" - mv build/bin "$FOLDER" - cp LICENSE.txt "$FOLDER" - tar -czf "$TAR" "$FOLDER" - echo "TAR_NAME=$TAR" >> $GITHUB_ENV - - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: windows-artifact - path: ${{ env.TAR_NAME }} - - release: - runs-on: ubuntu-latest - needs: [build-linux-x86_64, build-linux-arm64, build-macos, build-windows] - steps: - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - path: ./artifacts - merge-multiple: true - - - name: Create GitHub Release - uses: ncipollo/release-action@v1 - with: - tag: ${{ github.ref_name }} - name: Release ${{ github.ref_name }} - body: Automated release based on tag ${{ github.ref_name }} - draft: false - prerelease: ${{ startsWith(github.ref_name, 'prerelease-') }} - artifacts: "./artifacts/*" \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile index 8a5ddcd..b5074b8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -26,8 +26,13 @@ pipeline { // Expose for other stages env.TAG_NAME = tag - } else { - echo "Regular branch build: ${env.GIT_BRANCH}" + } else { + // Normal branch push = DEV build + def branchName = env.GIT_BRANCH.replace("refs/heads/", "") + echo "Regular branch build: ${branchName}" + + // Mark display name as a dev build + currentBuild.displayName = "#${env.BUILD_NUMBER} DEV-${branchName}" } } } @@ -88,4 +93,32 @@ pipeline { } } } + + post { + always { + script { + // Automatically detects full ref name + def ref = sh(script: "git rev-parse --symbolic-full-name HEAD", returnStdout: true).trim() + + if (ref.startsWith("refs/tags/")) { + // Extract tag name + def tag = ref.replace("refs/tags/", "") + echo "Detected tag: ${tag}" + + if (tag.toLowerCase().contains("unstable")) { + echo "Unstable tag detected" + currentBuild.result = "UNSTABLE" + } else { + echo "Stable tagged build" + currentBuild.description = "Stable" + currentBuild.result = "SUCCESS" + } + + } else { + echo "Regular commit → marking as dev build" + currentBuild.description = "Dev Build" + } + } + } + } }