Skip to content

version bump (#193) #204

version bump (#193)

version bump (#193) #204

Workflow file for this run

name: Build packages
on:
push:
branches:
- main
tags:
- "v*"
paths:
- .github/workflows/packages.yml
- deb.Dockerfile
- build/deb
- shard.lock
- src/**
workflow_dispatch:
jobs:
tar:
runs-on: ubuntu-latest
container:
image: 84codes/crystal:1.13.2-alpine
steps:
- uses: actions/checkout@v4
- name: Install Dependencies
run: shards install --production
- name: Build
run: build/tar 1
- name: Upload github artifact
uses: actions/upload-artifact@v4
with:
path: "*.tar.gz"
name: tar
deb:
runs-on: ubuntu-latest
strategy:
matrix:
os:
- ubuntu-noble # Ubuntu 24.04
- ubuntu-jammy # Ubuntu 22.04
- ubuntu-focal # Ubuntu 20.04
- debian-bookworm # Debian 12
- debian-bullseye # Debian 11
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build deb package
uses: docker/build-push-action@v6
with:
cache-from: type=gha,scope=deb-${{ matrix.os }}
cache-to: type=gha,mode=max,scope=deb-${{ matrix.os }}
file: deb.Dockerfile
platforms: linux/amd64,linux/arm64
build-args: |
image=84codes/crystal:1.13.2-${{ matrix.os }}
outputs: builds
- name: Upload GitHub artifact
uses: actions/upload-artifact@v4
with:
path: "builds/**/*.deb"
name: debs-${{ matrix.os }}
- name: Upload 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
for PKG_FILE in $(find builds -name "*.deb")
do
ID=$(echo $PKG_FILE | cut -d/ -f3)
VERSION_CODENAME=$(echo $PKG_FILE | cut -d/ -f4)
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
done