From e4d0c62193f7af0e0627608524bab8bfe6565eb2 Mon Sep 17 00:00:00 2001 From: Miro Stauder Date: Wed, 8 Mar 2023 22:47:50 +0100 Subject: [PATCH] Update package-build.yml --- .github/workflows/package-build.yml | 104 +++++++++++++++++++++------- 1 file changed, 80 insertions(+), 24 deletions(-) diff --git a/.github/workflows/package-build.yml b/.github/workflows/package-build.yml index 5c7c6c46bb..40b75ababf 100644 --- a/.github/workflows/package-build.yml +++ b/.github/workflows/package-build.yml @@ -20,8 +20,28 @@ concurrency: # 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 + build: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 + needs: [ clean ] strategy: fail-fast: false matrix: @@ -51,7 +71,7 @@ jobs: type: '-clang' - dist: 'ubuntu18' type: '-clang' - + steps: - name: Checkout repository uses: actions/checkout@v3 @@ -64,33 +84,49 @@ jobs: 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 }} - -# - name: Deploy to Repo -# uses: easingthemes/ssh-deploy@main -# env: -# SSH_PRIVATE_KEY: ${{ secrets.REPO_PRIVATE_KEY }} -# ARGS: "-ai" -# SOURCE: "binaries/" -# REMOTE_HOST: ${{ secrets.REPO_HOST }} -# REMOTE_USER: ${{ secrets.REPO_USER }} -# TARGET: ${{ secrets.REPO_TARGET }}/binaries-${{ env.GIT_VERSION }} -# EXCLUDE: "binaries/.gitignore" -# SCRIPT_BEFORE: | -# ls -ld ${{ secrets.REPO_TARGET }}/* -# (ls -1d ${{ secrets.REPO_TARGET }}/binaries-* || true) | sort -r | tail -n +10 | xargs -n1 rm -rf -# rm -rf ${{ secrets.REPO_TARGET }}/binaries-${{ env.GIT_VERSION }} - - - name: Publish release + 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: | - echo -e "### Development Snapshot\n\nGH-Action Package-Build on PR merge into v2.x\n\ngit describe : **${GIT_VERSION}**" | gh release edit v2.x-head --draft --prerelease --repo sysown/proxysql --notes-file - - gh release upload v2.x-head --repo sysown/proxysql --clobber binaries/proxysql*${{ matrix.dist }}*[mb] - + # 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 @@ -99,5 +135,25 @@ jobs: 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 in 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) + + +