From 464137e1abb7f96c34bfe5dc4efc981c4d437e69 Mon Sep 17 00:00:00 2001 From: Danilo Pianini Date: Fri, 18 Dec 2020 16:07:31 +0100 Subject: [PATCH] Create a monolithic workflow --- .github/workflows/build-and-deploy-latex.yml | 63 +++++++++++++++----- 1 file changed, 49 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build-and-deploy-latex.yml b/.github/workflows/build-and-deploy-latex.yml index 7b1ec883..5939a830 100644 --- a/.github/workflows/build-and-deploy-latex.yml +++ b/.github/workflows/build-and-deploy-latex.yml @@ -36,20 +36,55 @@ jobs: echo "Delivering file $pdf" gh release upload "$TAG" "$pdf" --clobber done <"success-list" - Automerge: - needs: Build-LaTeX + Deploy-Archives: runs-on: ubuntu-latest - if: always() steps: - - name: automerge - uses: "DanySK/yaagha@master" + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + submodules: true + - name: Fetch tags + shell: bash + run: git fetch --tags -f + - name: Autotag + uses: DanySK/semver-autotag-action@master + - name: Remove PMD/Checkstyle/Spotbugs configuration from the first labs + run: ./cleanup_project_files.rb + - name: Create archives + run: | + for file in workspace/*/; do + name="${file#*/}" + echo Creating "${name%*/}.zip" from $file + zip -r "${name%*/}.zip" "$file" + done + - name: Release + if: ${{ startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master' }} env: - GITHUB_TOKEN: "${{ secrets.AUTOMERGE_TOKEN }}" - MERGE_FORKS: "false" - MERGE_LABELS: "version-upgrade" - BLOCK_LABELS: "blocked, wontfix, invalid" - MERGE_METHOD: "rebase" - CLOSE_ON_CONFLICT: "true" - DELETE_BRANCH_ON_CLOSE: "true" - GIT_USER_NAME: "Danilo Pianini" - GIT_USER_EMAIL: "danilo.pianini@gmail.com" + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + TAG=$(git describe --tags --exact-match HEAD) + hub release create -m "$(git tag -l --format='%(contents)' "$TAG")" "$TAG" || true + ls -ahl + for file in $(find ~+ -name \*.zip); do + echo "Delivering file $file" + gh release upload "$TAG" "$file" --clobber + done + Refresh-Latest-Release: + runs-on: ubuntu-latest + needs: [Build-LaTeX, Deploy-Archives] + steps: + - name: Deploy + env: + GITHUB_TOKEN: ${{ secrets.AUTOMERGE_TOKEN }} + run: | + latest=$(gh release list -R APICe-at-DISI/OOP-Lab -L 1 | grep -Po 'Latest\s*\K(.*?)\s') + echo Latest release is $latest, downloading + gh release download $latest -R APICe-at-DISI/OOP-Lab + echo Create destination release if needed + gh release create -t "Release $latest" $latest -R APICe-at-DISI/OOP-Lab-public || true + for file in $(ls); do + echo "Delivering file $file" + gh release upload -R 'APICe-at-DISI/OOP-Lab-public' $latest "$file" --clobber + done +