Version bump #51
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: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'main' | |
tags: | |
- 'v*.*.*' | |
jobs: | |
build_deb: | |
name: Build | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: [amd64, arm64] | |
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, debian-bullseye, debian-bookworm] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get version | |
run: echo "PKG_VERSION=$(git describe --tags | cut -c2-)" >> $GITHUB_ENV | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build image and output result to builds | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: Dockerfile.deb | |
platforms: linux/${{ matrix.arch }} | |
build-args: | | |
build_image=84codes/crystal:1.13.3-${{ matrix.os }} | |
pkg_version=${{ env.PKG_VERSION }} | |
outputs: builds | |
- name: Upload deb to packagecloud | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: | | |
set -eux | |
curl -fsSO -u "${{ secrets.packagecloud_token }}:" https://packagecloud.io/api/v1/distributions.json | |
PKG_FILE=$(find builds -name "*.deb" | head -1) | |
ID=$(echo $PKG_FILE | cut -d/ -f2) | |
VERSION_CODENAME=$(echo $PKG_FILE | cut -d/ -f3) | |
DIST_ID=$(jq ".deb[] | select(.index_name == \"${ID}\").versions[] | select(.index_name == \"${VERSION_CODENAME}\").id" distributions.json) | |
curl -fsS -u "${{ secrets.packagecloud_token }}:" -XPOST \ | |
-F "package[distro_version_id]=${DIST_ID}" \ | |
-F "package[package_file]=@${PKG_FILE}" \ | |
https://packagecloud.io/api/v1/repos/${{ github.repository }}/packages.json |