Merge pull request #4304 from sysown/v2.6.0-tap_test_fixes #108
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-Build | |
on: | |
push: | |
branches: [ "v2.x" ] | |
paths-ignore: | |
- '.github/**' | |
- '**.md' | |
# pull_request: | |
# branches: [ "v2.x" ] | |
# paths-ignore: | |
# - '.github/**' | |
# - '**.md' | |
# schedule: | |
# - cron: '15 13 * * 3' | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }} | |
# cancel-in-progress: true | |
jobs: | |
clean: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Clean packages | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
# gh release delete-asset v2.x-head | |
gh release delete v2.x-head --repo ${{ github.repository }} --cleanup-tag || true | |
gh release create v2.x-head --repo ${{ github.repository }} --title v2.x-head --draft --prerelease --notes-file - << EOF | |
## Development Snapshot | |
GH-Action Package-Build on PR merge into v2.x | |
Started : **$(date '+%Y-%m-%d %H:%M:%S %Z')** | |
Status : **Build in progress** | |
EOF | |
- name: Clean repo | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.REPO_HOST }} | |
username: ${{ secrets.REPO_USER }} | |
key: ${{ secrets.REPO_PRIVATE_KEY }} | |
script: | | |
ls -1 ${{ secrets.REPO_TARGET }} | sort -rV | tail +11 | xargs -n1 rm -rf | |
build: | |
runs-on: ubuntu-22.04 | |
needs: [ clean ] | |
strategy: | |
fail-fast: false | |
matrix: | |
# dist: [ 'centos7' ] | |
dist: [ 'almalinux8','almalinux9','centos6','centos7','centos8','debian8','debian9','debian10','debian11','debian12','fedora27','fedora28','fedora33','fedora34','fedora36','fedora37','fedora38','opensuse15','ubuntu14','ubuntu16','ubuntu18','ubuntu20','ubuntu22' ] | |
type: [ '','-dbg','-clang' ] | |
exclude: | |
- dist: 'centos6' | |
type: '-clang' | |
- dist: 'centos7' | |
type: '-clang' | |
- dist: 'debian8' | |
type: '-clang' | |
- dist: 'debian9' | |
type: '-clang' | |
- dist: 'debian10' | |
type: '-clang' | |
- dist: 'fedora27' | |
type: '-clang' | |
- dist: 'fedora28' | |
type: '-clang' | |
- dist: 'fedora33' | |
type: '-clang' | |
- dist: 'ubuntu14' | |
type: '-clang' | |
- dist: 'ubuntu16' | |
type: '-clang' | |
- dist: 'ubuntu18' | |
type: '-clang' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
repository: 'sysown/proxysql' | |
# ref: 'v2.x' | |
fetch-depth: 0 | |
- name: Set GIT_VERSION | |
run: | | |
git fetch --tags --force | |
echo "GIT_VERSION=$(git describe --long --abbrev=7)" >> $GITHUB_ENV | |
- name: Update release | |
if: always() | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
if [[ "${{ matrix.dist }}" = "centos7" ]] && [[ "${{ matrix.type }}" = "" ]]; then | |
gh release edit v2.x-head --draft --prerelease --repo ${{ github.repository }} --tag v2.x-head --title "v2.x-head - ${GIT_VERSION}" --notes-file - << EOF | |
## Development Snapshot | |
GH-Action Package-Build on PR merge into v2.x | |
Updated : **$(date '+%Y-%m-%d %H:%M:%S %Z')** | |
Status : **Build in progress** | |
EOF | |
fi | |
- name: Build package | |
run: | | |
make ${{ matrix.dist }}${{ matrix.type }} | |
echo "BIN_PKG=$(ls -1 binaries/*[mb])" >> $GITHUB_ENV | |
echo "BIN_HASH=$(ls -1 binaries/*.id-hash)" >> $GITHUB_ENV | |
- name: Deploy to Repo | |
uses: easingthemes/ssh-deploy@main | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.REPO_PRIVATE_KEY }} | |
ARGS: "-aic" | |
SOURCE: ${{ env.BIN_PKG }} | |
REMOTE_HOST: ${{ secrets.REPO_HOST }} | |
REMOTE_USER: ${{ secrets.REPO_USER }} | |
TARGET: ${{ secrets.REPO_TARGET }}/binaries-${{ env.GIT_VERSION }}/ | |
EXCLUDE: binaries/.gitignore | |
- name: Push packages | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
# git tag --force -a v2.x-head -m 'GH-Actions - Development Snapshot Build' | |
# git push origin --tags | |
# gh release upload v2.x-head --repo ${{ github.repository }} --clobber binaries/proxysql*${{ matrix.dist }}*[mb] | |
gh release upload v2.x-head --repo ${{ github.repository }} --clobber ${{ env.BIN_PKG }} | |
# - name: Archive artifacts | |
# if: always() | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: binaries-${{ env.GIT_VERSION }} | |
# path: | | |
# ./binaries/ | |
# !./**/.gitignore | |
finalize: | |
runs-on: ubuntu-22.04 | |
needs: [ build ] | |
steps: | |
- name: Update release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release edit v2.x-head --draft --prerelease --repo ${{ github.repository }} --tag v2.x-head --notes-file - << EOF | |
## Development Snapshot | |
GH-Action Package-Build on PR merge into v2.x | |
Finished : **$(date '+%Y-%m-%d %H:%M:%S %Z')** | |
Status : **Build is finished** | |
[![Package-Build](https://github.com/${{ github.repository }}/actions/workflows/package-build.yml/badge.svg)](https://github.com/${{ github.repository }}/actions/workflows/package-build.yml) | |