name: Debian Packages on: workflow_dispatch: push: tags: - "ver.*" concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: build-amd64: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v5 with: fetch-depth: 0 - name: Install build dependencies run: | sudo apt-get update sudo apt-get install -y --no-install-recommends \ debhelper cmake ninja-build pkg-config doxygen \ libmarisa-dev rapidjson-dev libtclap-dev \ googletest libgtest-dev - name: Build amd64 packages env: DIST_DIR: ${{ github.workspace }}/dist BUILD_MODE: all run: bash scripts/build-deb-packages.sh - uses: actions/upload-artifact@v4 with: name: deb-amd64 path: dist/*.deb build-arm64: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v5 - name: Set up arm64 cross-compilation environment run: | sudo rm -f /etc/apt/sources.list sudo find /etc/apt/sources.list.d -maxdepth 1 \ \( -name '*.list' -o -name '*.sources' \) -exec rm -f {} + cat <<'EOF' | sudo tee /etc/apt/sources.list.d/opencc-cross.sources >/dev/null Types: deb URIs: http://archive.ubuntu.com/ubuntu Suites: noble noble-updates noble-backports Components: main restricted universe multiverse Architectures: amd64 Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg Types: deb URIs: http://security.ubuntu.com/ubuntu Suites: noble-security Components: main restricted universe multiverse Architectures: amd64 Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg Types: deb URIs: http://ports.ubuntu.com/ubuntu-ports Suites: noble noble-updates noble-backports noble-security Components: main restricted universe multiverse Architectures: arm64 Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg EOF sudo dpkg --add-architecture arm64 sudo apt-get update sudo apt-get install -y --no-install-recommends \ debhelper cmake ninja-build pkg-config \ crossbuild-essential-arm64 \ libmarisa-dev:arm64 rapidjson-dev libtclap-dev \ googletest libgtest-dev - name: Build arm64 packages env: DIST_DIR: ${{ github.workspace }}/dist BUILD_MODE: any-only TARGET_ARCH: arm64 run: bash scripts/build-deb-packages.sh - uses: actions/upload-artifact@v4 with: name: deb-arm64 path: dist/*.deb assemble: needs: [build-amd64, build-arm64] runs-on: ubuntu-24.04 permissions: contents: write steps: - uses: actions/checkout@v5 - uses: actions/download-artifact@v4 with: name: deb-amd64 path: dist/ - uses: actions/download-artifact@v4 with: name: deb-arm64 path: dist/ - name: Determine version id: version run: | VERSION=$(dpkg-parsechangelog \ -l packaging/debian/debian/changelog -S version) echo "value=$VERSION" >> "$GITHUB_OUTPUT" - name: Assemble zip with checksums run: | cd dist sha256sum ./*.deb > SHA256SUMS zip "opencc-${{ steps.version.outputs.value }}-deb.zip" ./*.deb SHA256SUMS - uses: actions/upload-artifact@v4 with: name: opencc-deb-${{ steps.version.outputs.value }} path: dist/opencc-*.zip - name: Upload to GitHub release if: startsWith(github.ref, 'refs/tags/') env: GH_TOKEN: ${{ github.token }} run: | tag="${{ github.ref_name }}" for i in $(seq 1 30); do gh release view "$tag" --json isDraft > /dev/null 2>&1 && break echo "Waiting for release $tag to be created ($i/30)..." sleep 10 done gh release upload "$tag" \ "dist/opencc-${{ steps.version.outputs.value }}-deb.zip" \ --clobber