Add Global Message Counters and Prometheus Metrics #4490
This file contains 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: | |
pull_request: | |
paths: | |
- .github/workflows/deb.yml | |
- Makefile | |
- Dockerfile.deb | |
- build/deb | |
- shard.lock | |
- src/** | |
- static/** | |
- views/** | |
- openapi/** | |
- debian/** | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
paths: | |
- .github/workflows/deb.yml | |
- Dockerfile.deb | |
- Makefile | |
- build/deb | |
- shard.lock | |
- src/** | |
- static/** | |
- views/** | |
- openapi/** | |
- debian/** | |
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, ubuntu-20.04, debian-12, debian-11] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
id-token: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
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: Dockerfile.deb | |
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@v4 | |
name: Upload artifact | |
with: | |
name: deb-packages-${{ matrix.os }} | |
path: builds | |
- name: Determine if pre-release | |
id: determine-prerelease | |
run: | | |
if [[ "${{ github.ref }}" == *"-rc"* ]]; then | |
echo "is_prerelease=true" >> $GITHUB_ENV | |
else | |
echo "is_prerelease=false" >> $GITHUB_ENV | |
fi | |
- 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') && env.is_prerelease == 'false' | |
- name: Upload to Packagecloud head 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 }}-head/packages.json | |
done | |
if: github.event_name != 'pull_request' | |
- 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') && env.is_prerelease == 'true' | |
rerun_on_failure: | |
needs: build_deb | |
if: failure() && github.run_attempt < 3 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
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 }} |