hard exit 3 when loosing leadership #2746
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: RPM | |
on: | |
pull_request: | |
paths: | |
- .github/workflows/rpm.yml | |
- Makefile | |
- Dockerfile.rpm | |
- build/lavinmq.spec | |
- shard.lock | |
- src/** | |
- static/** | |
- views/** | |
- openapi/** | |
- lavinmq.spec | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
paths: | |
- .github/workflows/rpm.yml | |
- Makefile | |
- Dockerfile.rpm | |
- build/lavinmq.spec | |
- shard.lock | |
- src/** | |
- static/** | |
- views/** | |
- openapi/** | |
- lavinmq.spec | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build_rpm: | |
name: Build RPM | |
strategy: | |
matrix: | |
os: ['fedora-41', 'fedora-40', 'el-9'] | |
runs-on: ubuntu-latest | |
# Set permissions if you're using OIDC token authentication | |
permissions: | |
contents: read | |
id-token: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Generate version string | |
run: echo "version=$(./rpm-version)" >> $GITHUB_ENV | |
- uses: depot/setup-action@v1 | |
- uses: depot/build-push-action@v1 | |
with: | |
file: Dockerfile.rpm | |
platforms: linux/amd64,linux/arm64 | |
pull: true | |
build-args: | | |
build_image=84codes/crystal:latest-${{ matrix.os }} | |
version=${{ env.version }} | |
MAKEFLAGS=-j1 | |
outputs: RPMS | |
- uses: actions/upload-artifact@v4 | |
name: Upload artifact | |
with: | |
name: rpm-packages-${{ matrix.os }} | |
path: RPMS | |
- name: Upload to Packagecloud | |
run: | | |
set -eux | |
curl -fsSO -u "${{ secrets.packagecloud_token }}:" https://packagecloud.io/api/v1/distributions.json | |
ID=$(cut -d- -f1 <<< ${{ matrix.os }}) | |
VERSION_ID=$(cut -d- -f2 <<< ${{ matrix.os }}) | |
DIST_ID=$(jq ".rpm[] | select(.index_name == \"${ID}\").versions[] | select(.index_name == \"${VERSION_ID}\").id" distributions.json) | |
for PKG_FILE in $(find RPMS -name "*.rpm" | sort -u -t/ -k3) | |
do 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 | |
if: startsWith(github.ref, 'refs/tags/v') | |
- name: Upload to Packagecloud head repo | |
run: | | |
set -eux | |
curl -fsSO -u "${{ secrets.packagecloud_token }}:" https://packagecloud.io/api/v1/distributions.json | |
ID=$(cut -d- -f1 <<< ${{ matrix.os }}) | |
VERSION_ID=$(cut -d- -f2 <<< ${{ matrix.os }}) | |
DIST_ID=$(jq ".rpm[] | select(.index_name == \"${ID}\").versions[] | select(.index_name == \"${VERSION_ID}\").id" distributions.json) | |
for PKG_FILE in $(find RPMS -name "*.rpm" | sort -u -t/ -k3) | |
do 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 }}-head/packages.json | |
done | |
if: github.event_name != 'pull_request' |