From 6aa92357e0bdd7c1bf6ddc65be100f050ce39f45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Wed, 18 Oct 2023 09:22:08 +0200 Subject: [PATCH] ajust ci --- .ci/ci_build.sh | 1 - ...m_origin.sh => setup_build_repo_branch.sh} | 6 +- .gitlab-ci.yml | 77 ++++++++----------- 3 files changed, 37 insertions(+), 47 deletions(-) rename .ci/{get_build_repo_from_origin.sh => setup_build_repo_branch.sh} (83%) diff --git a/.ci/ci_build.sh b/.ci/ci_build.sh index 16dbc90..4a5e582 100755 --- a/.ci/ci_build.sh +++ b/.ci/ci_build.sh @@ -15,4 +15,3 @@ cd build mv LatexPackagesBuild LatexPackages zip -r LatexPackages.zip LatexPackages/ -x '*.git*' zip -r LatexPackagesDocumentation.zip documentation -tree -H '.' -I "index.html" -D --charset utf-8 -T "LatexPackages" > index.html diff --git a/.ci/get_build_repo_from_origin.sh b/.ci/setup_build_repo_branch.sh similarity index 83% rename from .ci/get_build_repo_from_origin.sh rename to .ci/setup_build_repo_branch.sh index c53683b..ff4824a 100755 --- a/.ci/get_build_repo_from_origin.sh +++ b/.ci/setup_build_repo_branch.sh @@ -1,13 +1,13 @@ # ! /bin/sh set -e -ssh git@gitlab.com -git clone git@gitlab.com:latexci/packages/LatexPackagesBuild.git build/LatexPackagesBuild + cd build/LatexPackagesBuild + REMOTE_BRANCH=$(git branch -a | sed -n '/remotes\/origin\/.*-build/p' | sed 's/remotes\/origin\///g' | sed 's/-build//g' | sed 's/[[:space:]]//g' | sed -n "/^${CI_COMMIT_REF_NAME}$/p") echo ${REMOTE_BRANCH} -if [ "$REMOTE_BRANCH" = "" ];then +if [ "$REMOTE_BRANCH" = "" ]; then echo "This is the first build on this branch, creating new branch in build repository to push to" git checkout --orphan ${CI_COMMIT_REF_NAME}-build ls -ra | sed '/^\.git$/d' | sed '/^\.\.$/d' | sed '/^\.$/d' | xargs -r git rm --cached diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 60f19f3..7e7170c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,44 +1,35 @@ -stages: - - get - - build - - pages +name: Build LaTeX packages +on: [push] -get-build-repo: - stage: get - before_script: - - source .ci/configure_git.sh - script: - - echo "Getting old Build repo..." - - .ci/get_build_repo_from_origin.sh - artifacts: - paths: - - build/ - tags: - - latex - -build-packages: - stage: build - before_script: - - source .ci/configure_git.sh - script: - - echo "Building packages incrementally..." - - sh .ci/ci_build.sh - variables: - GIT_SUBMODULE_STRATEGY: recursive - artifacts: - paths: - - build/ - tags: - - latex - -pages: - stage: pages - artifacts: - paths: - - public/ - script: - - mv build/ public/ - tags: - - latex - only: - - master +jobs: + build: + runs-on: latex-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Setup git credentials and committer + run: .ci/configure_git.sh + - name: Clone build repository + uses: actions/checkout@v4 + with: + repository: latex-packages/latex-packages-build + fetch-depth: 0 # We need all history to correctly parse tag names + fetch-tags: true + path: build/LatexPackagesBuild + - name: Checkout correct branch in build repository + run: | + .ci/setup_build_repo_branch.sh + cd build/LatexPackagesBuild + git ls-remote --heads + - name: Build packages + run: | + .ci/ci_build.sh # Note that this includes pushing to the build mirror + deploy-pages: + runs-on: ubuntu-latest + needs: build + if: github.ref == 'refs/heads/master' + steps: + - name: Deploy to pages + uses: actions/pages@v1 + with: + directory: build/