Fix: handle valueless boolean CLI flags at compile time (#1842) #5146
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
| name: Debian packages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - v* | |
| paths: | |
| - .github/workflows/deb.yml | |
| - Makefile | |
| - shard.lock | |
| - src/** | |
| - static/** | |
| - views/** | |
| - openapi/** | |
| - packaging/debian/** | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build_deb: | |
| name: Build | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-24.04, ubuntu-22.04, debian-13, debian-12, debian-11] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Generate version string | |
| run: | | |
| git_describe=$(git describe --tags) | |
| echo "version=${git_describe:1}" >> $GITHUB_ENV | |
| - uses: depot/setup-action@v1 | |
| - uses: depot/build-push-action@v1 | |
| with: | |
| file: packaging/debian/Dockerfile | |
| platforms: linux/amd64,linux/arm64 | |
| pull: true | |
| build-args: | | |
| build_image=84codes/crystal:latest-${{ matrix.os }} | |
| version=${{ env.version }} | |
| DEB_BUILD_OPTIONS="parallel=1" | |
| outputs: builds | |
| - uses: actions/upload-artifact@v7 | |
| name: Upload artifact | |
| with: | |
| name: deb-packages-${{ matrix.os }} | |
| path: builds | |
| - name: Upload to Packagecloud | |
| run: | | |
| set -eux | |
| ID=$(cut -d- -f1 <<< ${{ matrix.os }}) | |
| VERSION_ID=$(cut -d- -f2 <<< ${{ matrix.os }}) | |
| if [ "$ID" = "debian" ] | |
| then VERSION_ID=${VERSION_ID}.0 | |
| fi | |
| curl -fsSO -u "${{ secrets.packagecloud_token }}:" https://packagecloud.io/api/v1/distributions.json | |
| DIST_ID=$(jq ".deb[] | select(.index_name == \"${ID}\").versions[] | select(.version_number == \"${VERSION_ID}\").id" distributions.json) | |
| for f in $(find builds -name "*.ddeb"); do mv -- "$f" "${f%.ddeb}.deb"; done | |
| for PKG_FILE in $(find builds -name "*.deb") | |
| do curl -u "${{ secrets.packagecloud_token }}:" -XPOST --no-progress-meter \ | |
| -F "package[distro_version_id]=${DIST_ID}" \ | |
| -F "package[package_file]=@${PKG_FILE}" \ | |
| https://packagecloud.io/api/v1/repos/${{ github.repository }}/packages.json | |
| done | |
| if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-rc') && !contains(github.ref, '-beta') && !contains(github.ref, '-alpha') | |
| - name: Upload to Packagecloud pre-release repo | |
| run: | | |
| set -eux | |
| ID=$(cut -d- -f1 <<< ${{ matrix.os }}) | |
| VERSION_ID=$(cut -d- -f2 <<< ${{ matrix.os }}) | |
| if [ "$ID" = "debian" ] | |
| then VERSION_ID=${VERSION_ID}.0 | |
| fi | |
| curl -fsSO -u "${{ secrets.packagecloud_token }}:" https://packagecloud.io/api/v1/distributions.json | |
| DIST_ID=$(jq ".deb[] | select(.index_name == \"${ID}\").versions[] | select(.version_number == \"${VERSION_ID}\").id" distributions.json) | |
| for f in $(find builds -name "*.ddeb"); do mv -- "$f" "${f%.ddeb}.deb"; done | |
| for PKG_FILE in $(find builds -name "*.deb") | |
| do curl -u "${{ secrets.packagecloud_token }}:" -XPOST --no-progress-meter \ | |
| -F "package[distro_version_id]=${DIST_ID}" \ | |
| -F "package[package_file]=@${PKG_FILE}" \ | |
| https://packagecloud.io/api/v1/repos/${{ github.repository }}-prerelease/packages.json | |
| done | |
| if: startsWith(github.ref, 'refs/tags/v') && (contains(github.ref, '-rc') || contains(github.ref, '-beta') || contains(github.ref, '-alpha')) | |
| rerun_on_failure: | |
| needs: build_deb | |
| if: failure() && github.run_attempt < 3 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Trigger rerun workflow | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh workflow run rerun.yml -r ${{ github.head_ref || github.ref_name }} -F run_id=${{ github.run_id }} |