|
6 | 6 | ubuntu_release: |
7 | 7 | description: 'Ubuntu release codename' |
8 | 8 | required: true |
9 | | - default: 'noble' |
| 9 | + default: 'oracular' |
10 | 10 | type: choice |
11 | 11 | options: |
12 | | - - noble # 24.04 LTS |
13 | | - - jammy # 22.04 LTS |
| 12 | + - oracular # 24.10 with Rust 1.81 |
| 13 | + - noble # 24.04 LTS with Rust 1.82 |
| 14 | + tarball_suffix: |
| 15 | + description: 'Tarball suffix (e.g., ds1, ds2) - leave empty for new releases' |
| 16 | + required: false |
| 17 | + default: '' |
| 18 | + type: string |
14 | 19 | push: |
15 | 20 | tags: |
16 | 21 | - 'v*' |
|
22 | 27 |
|
23 | 28 | jobs: |
24 | 29 | build-and-upload: |
25 | | - runs-on: ubuntu-22.04 |
| 30 | + runs-on: ubuntu-24.04 |
26 | 31 | strategy: |
27 | 32 | matrix: |
28 | 33 | ubuntu_release: |
29 | | - - noble |
30 | | - - jammy |
| 34 | + - questing |
31 | 35 |
|
32 | 36 | steps: |
33 | 37 | - name: Checkout code |
@@ -67,58 +71,91 @@ jobs: |
67 | 71 | id: version |
68 | 72 | run: | |
69 | 73 | VERSION=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/') |
70 | | - echo "version=$VERSION" >> $GITHUB_OUTPUT |
71 | 74 |
|
72 | | - # Set debian revision |
73 | | - if [ "${{ matrix.ubuntu_release }}" = "noble" ]; then |
74 | | - DEBIAN_REVISION="1ubuntu1" |
| 75 | + # Add tarball suffix if provided (e.g., +ds1, +ds2) |
| 76 | + TARBALL_SUFFIX="${{ github.event.inputs.tarball_suffix }}" |
| 77 | + if [ -n "$TARBALL_SUFFIX" ]; then |
| 78 | + TARBALL_VERSION="${VERSION}+${TARBALL_SUFFIX}" |
| 79 | + echo "version=$TARBALL_VERSION" >> $GITHUB_OUTPUT |
| 80 | + echo "Using tarball version: $TARBALL_VERSION" |
75 | 81 | else |
76 | | - DEBIAN_REVISION="1ubuntu1~${{ matrix.ubuntu_release }}1" |
| 82 | + echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 83 | + echo "Using version: $VERSION" |
77 | 84 | fi |
| 85 | +
|
| 86 | + # Extract Debian revision from changelog |
| 87 | + DEBIAN_REVISION=$(head -1 debian/changelog | sed 's/.*(\(.*\)-\(.*\)).*/\2/') |
78 | 88 | echo "debian_revision=$DEBIAN_REVISION" >> $GITHUB_OUTPUT |
79 | 89 |
|
80 | | - - name: Update debian/changelog |
| 90 | + - name: Update changelog |
81 | 91 | run: | |
82 | | - cd debian |
83 | | -
|
84 | | - # Update distribution |
85 | | - sed -i "s/) noble;/) ${{ matrix.ubuntu_release }};/" changelog |
86 | | -
|
87 | | - # For jammy, add backport entry |
88 | | - if [ "${{ matrix.ubuntu_release }}" = "jammy" ]; then |
89 | | - VERSION="${{ steps.version.outputs.version }}" |
90 | | - REVISION="${{ steps.version.outputs.debian_revision }}" |
91 | | - TIMESTAMP=$(date -R) |
92 | | -
|
93 | | - echo "rustnet-monitor ($VERSION-$REVISION) jammy; urgency=medium" > changelog.new |
94 | | - echo "" >> changelog.new |
95 | | - echo " * Backport to Ubuntu 22.04 Jammy" >> changelog.new |
96 | | - echo "" >> changelog.new |
97 | | - echo " -- Marco Cadetg <cadetg@gmail.com> $TIMESTAMP" >> changelog.new |
98 | | - echo "" >> changelog.new |
99 | | - cat changelog >> changelog.new |
100 | | - mv changelog.new changelog |
| 92 | + VERSION="${{ steps.version.outputs.version }}" |
| 93 | + CURRENT_VERSION=$(head -1 debian/changelog | sed 's/.*(\(.*\)).*/\1/') |
| 94 | +
|
| 95 | + if [ "$VERSION-1ubuntu1" != "$CURRENT_VERSION" ]; then |
| 96 | + echo "Updating changelog from $CURRENT_VERSION to $VERSION-1ubuntu1" |
| 97 | +
|
| 98 | + # Create new changelog entry |
| 99 | + DEBFULLNAME="${{ env.DEBFULLNAME }}" DEBEMAIL="${{ env.DEBEMAIL }}" \ |
| 100 | + dch --newversion "$VERSION-1ubuntu1" \ |
| 101 | + --distribution "questing" \ |
| 102 | + "New upstream release $VERSION" |
| 103 | +
|
| 104 | + echo "✓ Changelog updated" |
| 105 | + else |
| 106 | + echo "✓ Changelog already at correct version" |
101 | 107 | fi |
102 | 108 |
|
103 | 109 | - name: Build source package |
104 | 110 | run: | |
105 | 111 | VERSION="${{ steps.version.outputs.version }}" |
| 112 | + BASE_VERSION=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/') |
106 | 113 | PACKAGE_NAME="rustnet-monitor" |
107 | 114 |
|
108 | 115 | # Create build directory |
109 | 116 | mkdir -p build-ppa |
110 | 117 |
|
111 | | - # Create orig tarball |
112 | | - git archive --format=tar.gz --prefix="${PACKAGE_NAME}-${VERSION}/" HEAD \ |
113 | | - > "build-ppa/${PACKAGE_NAME}_${VERSION}.orig.tar.gz" |
| 118 | + # Extract source from release tag |
| 119 | + RELEASE_TAG="v${BASE_VERSION}" |
| 120 | + if git rev-parse "$RELEASE_TAG" >/dev/null 2>&1; then |
| 121 | + echo "✓ Found release tag: $RELEASE_TAG" |
| 122 | + git archive --format=tar --prefix="${PACKAGE_NAME}-${VERSION}/" "$RELEASE_TAG" | tar -x -C build-ppa |
| 123 | + else |
| 124 | + echo "⚠ Release tag $RELEASE_TAG not found, using HEAD" |
| 125 | + git archive --format=tar --prefix="${PACKAGE_NAME}-${VERSION}/" HEAD | tar -x -C build-ppa |
| 126 | + fi |
114 | 127 |
|
115 | | - # Extract and add debian directory |
116 | | - cd build-ppa |
117 | | - tar -xzf "${PACKAGE_NAME}_${VERSION}.orig.tar.gz" |
| 128 | + # Vendor dependencies separately from orig tarball |
| 129 | + echo "Vendoring Rust dependencies..." |
| 130 | + cd build-ppa/${PACKAGE_NAME}-${VERSION} |
| 131 | +
|
| 132 | + cargo vendor vendor |
| 133 | +
|
| 134 | + # Remove prebuilt static libraries (keep .dll for tests) |
| 135 | + echo "Cleaning vendor directory..." |
| 136 | + find vendor -name "*.a" -delete |
| 137 | + find vendor -name "*.lib" -delete |
| 138 | +
|
| 139 | + # Pack vendor directory as separate tarball in debian/ |
| 140 | + echo "Creating vendor tarball..." |
| 141 | + tar -cJf ../vendor.tar.xz vendor |
| 142 | + rm -rf vendor |
| 143 | +
|
| 144 | + # Create orig tarball (without vendor directory) |
| 145 | + echo "Creating orig tarball..." |
| 146 | + cd .. |
| 147 | + ORIG_TARBALL="${PACKAGE_NAME}_${VERSION}.orig.tar.gz" |
| 148 | + tar -czf "${ORIG_TARBALL}" "${PACKAGE_NAME}-${VERSION}" |
| 149 | +
|
| 150 | + # Add debian directory and vendor tarball |
118 | 151 | cp -r "$GITHUB_WORKSPACE/debian" "${PACKAGE_NAME}-${VERSION}/" |
| 152 | + mv vendor.tar.xz "${PACKAGE_NAME}-${VERSION}/debian/" |
119 | 153 |
|
120 | 154 | # Build source package |
121 | 155 | cd "${PACKAGE_NAME}-${VERSION}" |
| 156 | +
|
| 157 | + # Always use -sa to include orig tarball |
| 158 | + # Launchpad will reuse existing file if hash matches |
122 | 159 | debuild -S -sa -d -us -uc |
123 | 160 |
|
124 | 161 | - name: Sign and upload |
|
0 commit comments