From 30df03524f7fd84f3ecfea4524868ccc22c95dad Mon Sep 17 00:00:00 2001 From: Ginger Date: Mon, 8 Sep 2025 12:24:30 -0400 Subject: [PATCH 1/5] fix: Cache cargo-deb, use better versioning scheme --- .forgejo/workflows/build-debian.yml | 66 ++++++++++++++++++----------- 1 file changed, 42 insertions(+), 24 deletions(-) diff --git a/.forgejo/workflows/build-debian.yml b/.forgejo/workflows/build-debian.yml index f674a7c5..de7e5d97 100644 --- a/.forgejo/workflows/build-debian.yml +++ b/.forgejo/workflows/build-debian.yml @@ -33,25 +33,29 @@ jobs: echo "Debian distribution: $DISTRIBUTION ($VERSION)" - name: Get package revision and component - id: package_meta + id: package-meta run: | - # REVISION is appended to the package version, COMPONENT is used in + BASE_VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r ".packages[] | select(.name == \"conduwuit\").version" | sed 's/~/-/g') + # VERSION is the package version, COMPONENT is used in # apt's repository config like a git repo branch if [[ "${{ forge.ref }}" == "refs/tags/"* ]]; then COMPONENT="stable" - REVISION="stable" - elif [ "${{ forge.ref_name }}" = "main" ]; then - COMPONENT="dev" - REVISION="dev" + VERSION=$BASE_VERSION else - # Use sanitized ref name for the component - COMPONENT=$(echo "${{ forge.ref_name }}" | sed 's/[^a-zA-Z0-9]/-/g' | tr '[:upper:]' '[:lower:]' | cut -c1-30) - # and use SHA for the revision - REVISION=${{ forge.sha }} + SHA=$(echo "${{ forge.sha }}" | cut -c1-7) + DATE=$(date +%Y%M%d) + if [ "${{ forge.ref_name }}" = "main" ]; then + COMPONENT="dev" + else + # Use sanitized ref name for the component + COMPONENT=$(echo "${{ forge.ref_name }}" | sed 's/[^a-zA-Z0-9]/-/g' | tr '[:upper:]' '[:lower:]' | cut -c1-30) + fi + VERSION="$BASE_VERSION~git$DATE.$SHA-$COMPONENT" fi echo "component=$COMPONENT" >> $GITHUB_OUTPUT - echo "revision=$REVISION" >> $GITHUB_OUTPUT - echo "Target component: $COMPONENT revision $REVISION" + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "Component: $COMPONENT" + echo "Version: $VERSION" - name: Checkout repository with full history uses: https://code.forgejo.org/actions/checkout@v4 @@ -86,24 +90,38 @@ jobs: rust-version: nightly github-token: ${{ secrets.GH_PUBLIC_RO }} + - name: Check cargo-deb version + id: cargo-deb-version + run: echo "version=$(curl -s \"https://index.crates.io/ca/rg/cargo-deb\" | tail -n1 | jq -r .vers)" >> $GITHUB_OUTPUT + + - name: Cache cargo-deb installation + id: cache-cargo-deb + uses: actions/cache@v3 + with: + path: ~/.cargo/bin/cargo-deb + key: ${{ steps.cargo-deb-version.outputs.version }} + + - name: Install cargo-deb + if: steps.cache-cargo-deb.outputs.cache-hit != 'true' + run: cargo binstall cargo-deb + + - name: Run cargo-deb + id: cargo-deb + run: | + DEB_PATH=$(cargo deb --deb-version ${{ steps.package-meta.outputs.version }}) + echo "path=$DEB_PATH" >> $GITHUB_OUTPUT + - name: Install build dependencies run: | - cargo binstall cargo-deb apt-get update -y # Build dependencies for rocksdb apt-get install -y clang liburing-dev - - name: Run cargo-deb - id: cargo_deb - run: | - DEB_PATH=$(cargo deb --deb-revision ${{ steps.package_meta.outputs.revision }}) - echo "path=$DEB_PATH" >> $GITHUB_OUTPUT - - name: Test deb installation run: | - echo "Installing: ${{ steps.cargo_deb.outputs.path }}" + echo "Installing: ${{ steps.cargo-deb.outputs.path }}" - apt install -y ${{ steps.cargo_deb.outputs.path }} + apt install -y ${{ steps.cargo-deb.outputs.path }} apt info continuwuity @@ -115,15 +133,15 @@ jobs: uses: https://code.forgejo.org/actions/upload-artifact@v3 with: name: continuwuity - path: ${{ steps.cargo_deb.outputs.path }} + path: ${{ steps.cargo-deb.outputs.path }} - name: Publish to Forgejo package registry if: ${{ forge.event_name == 'push' || forge.event_name == 'workflow_dispatch' }} run: | OWNER="continuwuation" DISTRIBUTION=${{ steps.debian_version.outputs.distribution }} - COMPONENT=${{ steps.package_meta.outputs.component }} - DEB=${{ steps.cargo_deb.outputs.path }} + COMPONENT=${{ steps.package-meta.outputs.component }} + DEB=${{ steps.cargo-deb.outputs.path }} echo "Publishing: $DEB in component $COMPONENT for distribution $DISTRIBUTION" From d3c88c62423b87e1813c019a92f85e243af7fd5f Mon Sep 17 00:00:00 2001 From: Ginger Date: Mon, 8 Sep 2025 12:25:21 -0400 Subject: [PATCH 2/5] fix: Fix step order --- .forgejo/workflows/build-debian.yml | 50 ++++++++++++++--------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/.forgejo/workflows/build-debian.yml b/.forgejo/workflows/build-debian.yml index de7e5d97..27d26ec3 100644 --- a/.forgejo/workflows/build-debian.yml +++ b/.forgejo/workflows/build-debian.yml @@ -32,31 +32,6 @@ jobs: echo "distribution=$DISTRIBUTION" >> $GITHUB_OUTPUT echo "Debian distribution: $DISTRIBUTION ($VERSION)" - - name: Get package revision and component - id: package-meta - run: | - BASE_VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r ".packages[] | select(.name == \"conduwuit\").version" | sed 's/~/-/g') - # VERSION is the package version, COMPONENT is used in - # apt's repository config like a git repo branch - if [[ "${{ forge.ref }}" == "refs/tags/"* ]]; then - COMPONENT="stable" - VERSION=$BASE_VERSION - else - SHA=$(echo "${{ forge.sha }}" | cut -c1-7) - DATE=$(date +%Y%M%d) - if [ "${{ forge.ref_name }}" = "main" ]; then - COMPONENT="dev" - else - # Use sanitized ref name for the component - COMPONENT=$(echo "${{ forge.ref_name }}" | sed 's/[^a-zA-Z0-9]/-/g' | tr '[:upper:]' '[:lower:]' | cut -c1-30) - fi - VERSION="$BASE_VERSION~git$DATE.$SHA-$COMPONENT" - fi - echo "component=$COMPONENT" >> $GITHUB_OUTPUT - echo "version=$VERSION" >> $GITHUB_OUTPUT - echo "Component: $COMPONENT" - echo "Version: $VERSION" - - name: Checkout repository with full history uses: https://code.forgejo.org/actions/checkout@v4 with: @@ -90,6 +65,31 @@ jobs: rust-version: nightly github-token: ${{ secrets.GH_PUBLIC_RO }} + - name: Get package revision and component + id: package-meta + run: | + BASE_VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r ".packages[] | select(.name == \"conduwuit\").version" | sed 's/~/-/g') + # VERSION is the package version, COMPONENT is used in + # apt's repository config like a git repo branch + if [[ "${{ forge.ref }}" == "refs/tags/"* ]]; then + COMPONENT="stable" + VERSION=$BASE_VERSION + else + SHA=$(echo "${{ forge.sha }}" | cut -c1-7) + DATE=$(date +%Y%M%d) + if [ "${{ forge.ref_name }}" = "main" ]; then + COMPONENT="dev" + else + # Use sanitized ref name for the component + COMPONENT=$(echo "${{ forge.ref_name }}" | sed 's/[^a-zA-Z0-9]/-/g' | tr '[:upper:]' '[:lower:]' | cut -c1-30) + fi + VERSION="$BASE_VERSION~git$DATE.$SHA-$COMPONENT" + fi + echo "component=$COMPONENT" >> $GITHUB_OUTPUT + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "Component: $COMPONENT" + echo "Version: $VERSION" + - name: Check cargo-deb version id: cargo-deb-version run: echo "version=$(curl -s \"https://index.crates.io/ca/rg/cargo-deb\" | tail -n1 | jq -r .vers)" >> $GITHUB_OUTPUT From 53a7e815da39b6c13bf5098ea8d94f191c63364d Mon Sep 17 00:00:00 2001 From: Ginger Date: Mon, 8 Sep 2025 12:31:09 -0400 Subject: [PATCH 3/5] fix: Use month instead of minute in package timestamps --- .forgejo/workflows/build-debian.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/build-debian.yml b/.forgejo/workflows/build-debian.yml index 27d26ec3..3e0723ba 100644 --- a/.forgejo/workflows/build-debian.yml +++ b/.forgejo/workflows/build-debian.yml @@ -76,7 +76,7 @@ jobs: VERSION=$BASE_VERSION else SHA=$(echo "${{ forge.sha }}" | cut -c1-7) - DATE=$(date +%Y%M%d) + DATE=$(date +%Y%m%d) if [ "${{ forge.ref_name }}" = "main" ]; then COMPONENT="dev" else From 67810682cd41d38892561015da420032dc425d6f Mon Sep 17 00:00:00 2001 From: Ginger Date: Mon, 8 Sep 2025 12:34:17 -0400 Subject: [PATCH 4/5] =?UTF-8?q?fix:=20Install=20build=20dependencies=20=5F?= =?UTF-8?q?before=5F=20running=20the=20build=20=F0=9F=92=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .forgejo/workflows/build-debian.yml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/.forgejo/workflows/build-debian.yml b/.forgejo/workflows/build-debian.yml index 3e0723ba..637d20fb 100644 --- a/.forgejo/workflows/build-debian.yml +++ b/.forgejo/workflows/build-debian.yml @@ -65,7 +65,7 @@ jobs: rust-version: nightly github-token: ${{ secrets.GH_PUBLIC_RO }} - - name: Get package revision and component + - name: Get package version and component id: package-meta run: | BASE_VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r ".packages[] | select(.name == \"conduwuit\").version" | sed 's/~/-/g') @@ -92,7 +92,10 @@ jobs: - name: Check cargo-deb version id: cargo-deb-version - run: echo "version=$(curl -s \"https://index.crates.io/ca/rg/cargo-deb\" | tail -n1 | jq -r .vers)" >> $GITHUB_OUTPUT + run: | + VERSION=$(curl -s https://index.crates.io/ca/rg/cargo-deb | tail -n1 | jq -r .vers) + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "Latest cargo-deb version: $VERSION" - name: Cache cargo-deb installation id: cache-cargo-deb @@ -105,18 +108,18 @@ jobs: if: steps.cache-cargo-deb.outputs.cache-hit != 'true' run: cargo binstall cargo-deb - - name: Run cargo-deb - id: cargo-deb - run: | - DEB_PATH=$(cargo deb --deb-version ${{ steps.package-meta.outputs.version }}) - echo "path=$DEB_PATH" >> $GITHUB_OUTPUT - - name: Install build dependencies run: | apt-get update -y # Build dependencies for rocksdb apt-get install -y clang liburing-dev + - name: Run cargo-deb + id: cargo-deb + run: | + DEB_PATH=$(cargo deb --deb-version ${{ steps.package-meta.outputs.version }}) + echo "path=$DEB_PATH" >> $GITHUB_OUTPUT + - name: Test deb installation run: | echo "Installing: ${{ steps.cargo-deb.outputs.path }}" From 980b39c94699172ce504ab3de1c11949c306271c Mon Sep 17 00:00:00 2001 From: Ginger Date: Mon, 8 Sep 2025 12:42:24 -0400 Subject: [PATCH 5/5] fix: Munge version names better --- .forgejo/workflows/build-debian.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/build-debian.yml b/.forgejo/workflows/build-debian.yml index 637d20fb..d94b282e 100644 --- a/.forgejo/workflows/build-debian.yml +++ b/.forgejo/workflows/build-debian.yml @@ -68,7 +68,7 @@ jobs: - name: Get package version and component id: package-meta run: | - BASE_VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r ".packages[] | select(.name == \"conduwuit\").version" | sed 's/~/-/g') + BASE_VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r ".packages[] | select(.name == \"conduwuit\").version" | sed 's/[^a-zA-Z0-9.+]/~/g') # VERSION is the package version, COMPONENT is used in # apt's repository config like a git repo branch if [[ "${{ forge.ref }}" == "refs/tags/"* ]]; then @@ -81,7 +81,7 @@ jobs: COMPONENT="dev" else # Use sanitized ref name for the component - COMPONENT=$(echo "${{ forge.ref_name }}" | sed 's/[^a-zA-Z0-9]/-/g' | tr '[:upper:]' '[:lower:]' | cut -c1-30) + COMPONENT=$(echo "${{ forge.ref_name }}" | sed 's/[^a-zA-Z0-9.+]/~/g' | tr '[:upper:]' '[:lower:]' | cut -c1-30) fi VERSION="$BASE_VERSION~git$DATE.$SHA-$COMPONENT" fi