chore(release): update version.txt to v0.1.0-alpha.53 #1
This file contains hidden or 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
| # Workflow: CLI Release | |
| # Description: Builds and packages CLI component using Poetry and fpm | |
| # Why: Produces installable CLI packages | |
| name: Build and Package CLI | |
| on: | |
| push: | |
| branches: [master] | |
| paths: | |
| - "cli/**" | |
| - ".github/workflows/release-cli.yml" | |
| pull_request: | |
| paths: | |
| - "cli/**" | |
| - ".github/workflows/release-cli.yml" | |
| workflow_dispatch: | |
| jobs: | |
| build-and-package: | |
| runs-on: ubuntu-22.04 | |
| outputs: | |
| version: ${{ steps.version.outputs.VERSION }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| ssh-key: ${{ secrets.DEPLOY_KEY }} | |
| # dev builds run on host, prod uses PyInstaller on host | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.11" | |
| - name: Install Poetry | |
| uses: snok/install-poetry@v1 | |
| with: | |
| version: latest | |
| virtualenvs-create: true | |
| virtualenvs-in-project: true | |
| - name: Cache dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: cli/.venv | |
| key: venv-${{ runner.os }}-${{ hashFiles('cli/poetry.lock') }} | |
| - name: Install dependencies | |
| working-directory: cli | |
| run: poetry install | |
| - name: Extract version from pyproject.toml | |
| id: version | |
| working-directory: cli | |
| run: | | |
| VERSION=$(poetry version --short) | |
| echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Extracted version: $VERSION" | |
| - name: Install Ruby and fpm | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ruby ruby-dev rubygems build-essential | |
| sudo gem install --no-document fpm | |
| - name: Build CLI binary (PRs use dev mode / pushes build production) | |
| working-directory: cli | |
| env: | |
| NIXOPUS_DISABLE_DOCKER: "1" | |
| run: | | |
| chmod +x build.sh | |
| if [ ! -d "helpers" ]; then | |
| ln -s ../helpers helpers | |
| fi | |
| if [ "${{ github.event_name }}" = "pull_request" ]; then | |
| echo "Running dev-mode build (no PyInstaller)" | |
| ./build.sh --dev --no-test --no-cleanup | |
| else | |
| echo "Running production build (PyInstaller)" | |
| ./build.sh --no-test --no-cleanup --no-archive | |
| fi | |
| - name: Prepare binary for packaging | |
| working-directory: cli | |
| run: | | |
| mkdir -p packaging/usr/local/bin | |
| if [ -f "dist/nixopus" ]; then | |
| cp dist/nixopus packaging/usr/local/bin/ | |
| if [ -d "dist/nixopus_linux_amd64" ]; then | |
| cp -r dist/nixopus_linux_amd64 packaging/usr/local/bin/ | |
| elif [ -d "dist/nixopus_linux_arm64" ]; then | |
| cp -r dist/nixopus_linux_arm64 packaging/usr/local/bin/ | |
| fi | |
| else | |
| echo "Build output not found in expected location" | |
| ls -la dist/ | |
| exit 1 | |
| fi | |
| chmod +x packaging/usr/local/bin/nixopus | |
| - name: Set architecture variables | |
| run: | | |
| ARCH=$(uname -m) | |
| case "$ARCH" in | |
| x86_64) PKG_ARCH=amd64 ;; | |
| aarch64|arm64) PKG_ARCH=arm64 ;; | |
| *) PKG_ARCH=$ARCH ;; | |
| esac | |
| echo "ARCH=$ARCH" >> $GITHUB_ENV | |
| echo "PKG_ARCH=$PKG_ARCH" >> $GITHUB_ENV | |
| - name: Create DEB package | |
| working-directory: cli | |
| run: | | |
| fpm -s dir -t deb \ | |
| -n nixopus \ | |
| -v "${{ steps.version.outputs.VERSION }}" \ | |
| -a "$PKG_ARCH" \ | |
| --description "A CLI for Nixopus" \ | |
| --maintainer "Nixopus <[email protected]>" \ | |
| --license "FSL" \ | |
| --url "https://github.com/nixopus/cli" \ | |
| --deb-priority optional \ | |
| --deb-compression bzip2 \ | |
| --prefix / \ | |
| packaging/=/ | |
| - name: Create RPM package | |
| working-directory: cli | |
| run: | | |
| fpm -s dir -t rpm \ | |
| -n nixopus \ | |
| -v "${{ steps.version.outputs.VERSION }}" \ | |
| -a "$PKG_ARCH" \ | |
| --description "A CLI for Nixopus" \ | |
| --maintainer "Nixopus <[email protected]>" \ | |
| --license "FSL" \ | |
| --url "https://github.com/nixopus/cli" \ | |
| --rpm-compression bzip2 \ | |
| --prefix / \ | |
| packaging/=/ | |
| - name: Create TAR.GZ package | |
| working-directory: cli | |
| run: | | |
| fpm -s dir -t tar \ | |
| -n nixopus \ | |
| -v "${{ steps.version.outputs.VERSION }}" \ | |
| -a "$PKG_ARCH" \ | |
| --description "A CLI for Nixopus" \ | |
| --maintainer "Nixopus <[email protected]>" \ | |
| --license "FSL" \ | |
| --url "https://github.com/nixopus/cli" \ | |
| --prefix / \ | |
| packaging/=/ | |
| - name: Create APK package | |
| working-directory: cli | |
| run: | | |
| fpm -s dir -t apk \ | |
| -n nixopus \ | |
| -v "${{ steps.version.outputs.VERSION }}" \ | |
| -a "$PKG_ARCH" \ | |
| --description "A CLI for Nixopus" \ | |
| --maintainer "Nixopus <[email protected]>" \ | |
| --license "FSL" \ | |
| --url "https://github.com/nixopus/cli" \ | |
| --prefix / \ | |
| packaging/=/ | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nixopus-packages-${{ env.ARCH }} | |
| path: | | |
| cli/*.deb | |
| cli/*.rpm | |
| cli/*.tar | |
| cli/*.apk | |
| retention-days: 30 | |
| build-and-package-macos: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [macos-13, macos-14] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| ssh-key: ${{ secrets.DEPLOY_KEY }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.11" | |
| - name: Install Poetry | |
| uses: snok/install-poetry@v1 | |
| with: | |
| version: latest | |
| virtualenvs-create: true | |
| virtualenvs-in-project: true | |
| - name: Cache dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: cli/.venv | |
| key: venv-${{ matrix.os }}-${{ hashFiles('cli/poetry.lock') }} | |
| - name: Install dependencies | |
| working-directory: cli | |
| run: poetry install | |
| - name: Extract version from pyproject.toml | |
| id: version | |
| working-directory: cli | |
| run: | | |
| VERSION=$(poetry version --short) | |
| echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Extracted version: $VERSION" | |
| - name: Install fpm | |
| run: | | |
| sudo gem install --no-document fpm | |
| - name: Build CLI binary | |
| working-directory: cli | |
| env: | |
| NIXOPUS_DISABLE_DOCKER: "1" | |
| run: | | |
| chmod +x build.sh | |
| if [ ! -d "helpers" ]; then | |
| ln -s ../helpers helpers | |
| fi | |
| echo "Running production build (PyInstaller)" | |
| ./build.sh --no-test --no-cleanup --no-archive | |
| - name: Prepare binary for packaging | |
| working-directory: cli | |
| run: | | |
| mkdir -p packaging/usr/local/bin | |
| if [ -f "dist/nixopus" ]; then | |
| cp dist/nixopus packaging/usr/local/bin/ | |
| if [ -d "dist/nixopus_darwin_amd64" ]; then | |
| cp -r dist/nixopus_darwin_amd64 packaging/usr/local/bin/ | |
| elif [ -d "dist/nixopus_darwin_arm64" ]; then | |
| cp -r dist/nixopus_darwin_arm64 packaging/usr/local/bin/ | |
| fi | |
| else | |
| echo "Build output not found in expected location" | |
| ls -la dist/ | |
| exit 1 | |
| fi | |
| chmod +x packaging/usr/local/bin/nixopus | |
| - name: Set architecture variables | |
| run: | | |
| ARCH=$(uname -m) | |
| case "$ARCH" in | |
| x86_64) PKG_ARCH=amd64 ;; | |
| aarch64|arm64) PKG_ARCH=arm64 ;; | |
| *) PKG_ARCH=$ARCH ;; | |
| esac | |
| echo "ARCH=$ARCH" >> $GITHUB_ENV | |
| echo "PKG_ARCH=$PKG_ARCH" >> $GITHUB_ENV | |
| - name: Create PKG package | |
| working-directory: cli | |
| run: | | |
| VERSION="${{ steps.version.outputs.VERSION }}" | |
| fpm -s dir -t osxpkg \ | |
| -n nixopus \ | |
| -v "$VERSION" \ | |
| -a "$PKG_ARCH" \ | |
| --description "A CLI for Nixopus" \ | |
| --maintainer "Nixopus <[email protected]>" \ | |
| --license "FSL" \ | |
| --url "https://github.com/nixopus/cli" \ | |
| --prefix / \ | |
| packaging/=/ | |
| PKG_SOURCE="nixopus-${VERSION}.pkg" | |
| PKG_TARGET="nixopus-${VERSION}-darwin-$PKG_ARCH.pkg" | |
| mv "$PKG_SOURCE" "$PKG_TARGET" | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nixopus-packages-${{ matrix.os }}-${{ env.ARCH }} | |
| path: | | |
| cli/*.pkg | |
| retention-days: 30 | |
| create-release: | |
| needs: | |
| - build-and-package | |
| - build-and-package-macos | |
| runs-on: ubuntu-22.04 | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| if: github.ref == 'refs/heads/master' && github.event_name == 'push' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| fetch-depth: 0 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: ./artifacts | |
| - name: Update root package.json with CLI version | |
| run: | | |
| CLI_VERSION="${{ needs.build-and-package.outputs.version }}" | |
| echo "Updating root package.json with CLI version: $CLI_VERSION" | |
| # Collect all package file names | |
| PACKAGE_FILES=() | |
| while IFS= read -r -d '' file; do | |
| filename=$(basename "$file") | |
| PACKAGE_FILES+=("$filename") | |
| done < <(find ./artifacts -type f \( -name "*.deb" -o -name "*.rpm" -o -name "*.tar" -o -name "*.apk" -o -name "*.pkg" \) -print0) | |
| echo "Found package files: ${PACKAGE_FILES[@]}" | |
| # Convert array to JSON format | |
| PACKAGES_JSON=$(printf '%s\n' "${PACKAGE_FILES[@]}" | jq -R . | jq -s .) | |
| echo "Packages JSON: $PACKAGES_JSON" | |
| # Update package.json with version and package list | |
| jq --arg version "$CLI_VERSION" \ | |
| --argjson packages "$PACKAGES_JSON" \ | |
| '. + {"cli-version": $version, "cli-packages": $packages}' \ | |
| package.json > package.json.tmp | |
| mv package.json.tmp package.json | |
| echo "Updated package.json content:" | |
| jq '.["cli-version"], .["cli-packages"]' package.json | |
| - name: Create Pull Request for package.json update | |
| if: ${{ needs.build-and-package.outputs.version != '' }} | |
| uses: peter-evans/create-pull-request@v5 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| commit-message: "chore: update cli-version to ${{ needs.build-and-package.outputs.version }} and cli-packages array" | |
| title: "chore: update cli-version to ${{ needs.build-and-package.outputs.version }}" | |
| body: | | |
| This PR updates the `cli-version` field and `cli-packages` array in the root package.json to match the current CLI version (${{ needs.build-and-package.outputs.version }}) from the pyproject.toml file. | |
| **Changes:** | |
| - Updated `cli-version` field to `${{ needs.build-and-package.outputs.version }}` | |
| - Updated `cli-packages` array with available package files | |
| This PR was automatically created by the CLI release workflow. | |
| branch: "chore/update-cli-version-${{ needs.build-and-package.outputs.version }}" | |
| delete-branch: true | |
| base: "master" | |
| - name: Create GitHub Release | |
| run: | | |
| CLI_VERSION="${{ needs.build-and-package.outputs.version }}" | |
| RELEASE_TAG="nixopus-$CLI_VERSION" | |
| echo "Creating release with tag: $RELEASE_TAG" | |
| echo "Files to upload:" | |
| find ./artifacts -type f \( -name "*.deb" -o -name "*.rpm" -o -name "*.tar" -o -name "*.apk" -o -name "*.pkg" \) -exec ls -la {} \; | |
| gh release create "$RELEASE_TAG" \ | |
| --title "Nixopus CLI v$CLI_VERSION" \ | |
| --notes "Nixopus CLI v$CLI_VERSION - Packages: DEB, RPM, TAR, APK for x86_64 and ARM64" \ | |
| --target ${{ github.ref_name }} \ | |
| --prerelease | |
| find ./artifacts -type f \( -name "*.deb" -o -name "*.rpm" -o -name "*.tar" -o -name "*.apk" -o -name "*.pkg" \) -exec gh release upload "$RELEASE_TAG" {} \; | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |