diff options
author | Mattthew Weger | 2024-05-17 19:54:25 +0000 |
---|---|---|
committer | Mattthew Weger | 2024-05-17 19:54:25 +0000 |
commit | 6ed1f49cce915fc0ce0720165c55bb03809f3754 (patch) | |
tree | bf1acb1ed025908e136a898b0b166b350c6b7daf | |
parent | 944fe6906785be2b46cb0afad741e59acca0c3b2 (diff) | |
download | aur-6ed1f49cce915fc0ce0720165c55bb03809f3754.tar.gz |
ci
-rw-r--r-- | .gitlab-ci.yml | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 90890f3924cc..1ad5f647c954 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,25 +1,24 @@ image: archlinux:base-devel -# Cache directories to speed up consecutive builds -cache: - key: system-v1 - paths: - - .pkg-cache - - .venv - - .pre-commit - variables: PACKAGE_NAME: "auto_facelock" + AUR_REPO: "ssh://aur@aur.archlinux.org/${PACKAGE_NAME}.git" + COMMIT_HASH: "$CI_COMMIT_SHORT_SHA" CURRENT_DIR: "$(pwd)" -# Define stages stages: - lint - build - archive - publish -# Lint stage +cache: + key: system-v1 + paths: + - .pkg-cache + - .venv + - .pre-commit + lint: stage: lint before_script: @@ -29,8 +28,7 @@ lint: - export XDG_CACHE_HOME=.pre-commit - pre-commit run -a -# Build stage -build_package: +build: stage: build script: - pacman -Syu --noconfirm --needed --cachedir .pkg-cache git yay @@ -42,33 +40,37 @@ build_package: - "*.src.tar.gz" expire_in: 1 week -# Archive stage -rename_artifacts: +archive: stage: archive script: - mkdir -p artifacts - - COMMIT_HASH=$(git rev-parse --short HEAD) - mv *.pkg.tar.* "artifacts/${PACKAGE_NAME}-${COMMIT_HASH}.pkg.tar.xz" - mv *.src.tar.gz "artifacts/${PACKAGE_NAME}-${COMMIT_HASH}.src.tar.gz" dependencies: - - build_package + - build artifacts: paths: - artifacts/ expire_in: 1 week -# Publish stage (optional) -publish_to_aur: +publish: stage: publish script: - pacman -S --noconfirm --needed --cachedir .pkg-cache openssh - mkdir -p ~/.ssh - chmod 700 ~/.ssh - echo "$AUR_SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - - - git remote add aur ssh://aur@aur.archlinux.org/your-aur-package.git - - git push aur main + - git clone $AUR_REPO aur_repo + - cd aur_repo + - cp ../artifacts/*.pkg.tar.xz . + - cp ../artifacts/*.src.tar.gz . + - cp ../PKGBUILD . + - cp ../.SRCINFO . + - git add PKGBUILD .SRCINFO + - git commit -m "Update package to commit ${COMMIT_HASH}" + - git push origin master dependencies: - - rename_artifacts + - archive environment: name: production when: manual |