Package #1190
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: Package | |
on: | |
push: | |
branches: | |
- "*" | |
tags: | |
- "*" | |
pull_request: | |
branches: | |
- "*" | |
schedule: | |
- cron: | | |
0 0 * * * | |
jobs: | |
source: | |
name: Source | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
sudo apt update | |
sudo apt -y -V install software-properties-common | |
sudo add-apt-repository -y universe | |
sudo add-apt-repository -y ppa:groonga/ppa | |
sudo apt update | |
sudo apt -V install \ | |
libgroonga-dev | |
- name: Generate configure | |
run: | | |
./autogen.sh | |
- name: Configure for archive | |
run: | | |
./configure | |
- name: Build archive | |
run: | | |
make dist | |
- name: Create .zip archive | |
run: | | |
version=$(cat version) | |
tar xf groonga-normalizer-mysql-${version}.tar.gz | |
zip -r groonga-normalizer-mysql-${version}{.zip,} | |
# Artifact | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: source | |
path: | | |
groonga-normalizer-mysql-*.tar.gz | |
groonga-normalizer-mysql-*.zip | |
# Release | |
- name: Upload to release | |
if: | | |
github.ref_type == 'tag' | |
run: | | |
ruby \ | |
-e 'print("## groonga-normalizer-mysql "); \ | |
puts(ARGF.read.split(/^## /)[1].strip)' \ | |
doc/text/news.md > release-note.md | |
version=${GITHUB_REF_NAME#v} | |
title="$(head -n1 release-note.md | sed -e 's/^## //')" | |
tail -n +2 release-note.md > release-note-without-version.md | |
gh release create ${GITHUB_REF_NAME} \ | |
--discussion-category Announcements \ | |
--notes-file release-note-without-version.md \ | |
--title "${title}" \ | |
groonga-normalizer-mysql-*.tar.gz \ | |
groonga-normalizer-mysql-*.zip | |
env: | |
GH_TOKEN: ${{ github.token }} | |
build: | |
name: Build | |
needs: source | |
strategy: | |
fail-fast: false | |
matrix: | |
id: | |
- debian-bookworm-amd64 | |
- debian-bookworm-arm64 | |
- debian-trixie-amd64 | |
- debian-trixie-arm64 | |
- almalinux-8 | |
- almalinux-8-aarch64 | |
- almalinux-9 | |
- almalinux-9-aarch64 | |
runs-on: ubuntu-latest | |
env: | |
APACHE_ARROW_REPOSITORY: ${{ github.workspace }}/apache-arrow | |
steps: | |
- name: Prepare environment variables | |
run: | | |
set -eux | |
id=${{ matrix.id }} | |
case ${id} in | |
debian-*) | |
echo "APT_TARGETS=${id%-amd64}" >> ${GITHUB_ENV} | |
echo "TASK_NAMESPACE=apt" >> ${GITHUB_ENV} | |
;; | |
*) | |
echo "YUM_TARGETS=${id}" >> ${GITHUB_ENV} | |
echo "TASK_NAMESPACE=yum" >> ${GITHUB_ENV} | |
;; | |
esac | |
- name: Install dependencies | |
run: | | |
sudo apt update | |
sudo apt -V install \ | |
devscripts \ | |
qemu-user-static \ | |
ruby | |
- uses: actions/checkout@v4 | |
- uses: actions/checkout@v4 | |
with: | |
path: groonga | |
repository: groonga/groonga | |
submodules: recursive | |
- uses: actions/checkout@v4 | |
with: | |
path: apache-arrow | |
repository: apache/arrow | |
- uses: actions/download-artifact@v4 | |
with: | |
name: source | |
- name: Update version | |
if: | | |
github.ref_type != 'tag' | |
run: | | |
cd packages | |
rake version:update | |
env: | |
GROONGA_REPOSITORY: ../groonga | |
- name: Login to GitHub Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build with docker | |
run: | | |
cd packages | |
rake docker:pull || : | |
rake ${TASK_NAMESPACE}:build | |
env: | |
GROONGA_REPOSITORY: ../groonga | |
- name: Push the built Docker image | |
continue-on-error: true | |
run: | | |
cd packages | |
rake docker:push | |
env: | |
GROONGA_REPOSITORY: ../groonga | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: packages-${{ matrix.id }} | |
path: packages/${{ env.TASK_NAMESPACE }}/repositories/ | |
# Release | |
- name: Upload to release | |
if: | | |
github.ref_type == 'tag' | |
run: | | |
tar czf ${{ matrix.id }}.tar.gz \ | |
packages/${{ env.TASK_NAMESPACE }}/repositories/ | |
gh release upload ${GITHUB_REF_NAME} \ | |
${{ matrix.id }}.tar.gz | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |