Build deb packages without extra debug symbols #158
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: 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:latest-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-jammy", "ubuntu-focal", "ubuntu-bionic", "debian-buster", "debian-bullseye"] | |
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@v5 | |
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:latest-${{ 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 |