Skip to content
Snippets Groups Projects
Verified Commit f96d667f authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

fix: test gorelease

parent 0dc5d644
No related branches found
No related tags found
No related merge requests found
......@@ -5,17 +5,13 @@ services:
variables:
# The repo name as used in
# https://github.com/nix-community/NUR/blob/master/repos.json
NIXOS_VERSION: "23.05"
NIXPKGS_ALLOW_UNFREE: "1"
NIXPKGS_ALLOW_INSECURE: "1"
DOCKER_DRIVER: overlay2
#GIT_DEPTH: 10
stages:
# - build
- tag
- release
......@@ -23,18 +19,18 @@ stages:
tag-it:
stage: tag
script:
- git config user.email "''${GITLAB_USER_EMAIL}"
- git config user.name "''${GITLAB_USER_NAME:-"Gitlab CI"}"
- git config credential.helper '!f() { echo "username=gitlab-ci-token"; echo "password=''${CI_JOB_TOKEN}"; }; f'
- git config pull.rebase true
- git config http.sslVerify "false"
- git remote set-url origin https://pad:''${GITLAB_TOKEN}@''${CI_REPOSITORY_URL#*@}
- git fetch --all --tags --unshallow
- git reset --hard origin/master
- git checkout $CI_COMMIT_REF_NAME
- git pull origin $CI_COMMIT_REF_NAME
- version auto exit-code-if-no-bump
- git push origin $CI_COMMIT_REF_NAME
- /nix/store/zrs710jpfn7ngy5z4c6rrwwjq33b2a0y-git-2.42.0/bin/git config user.email "${GITLAB_USER_EMAIL}"
- /nix/store/zrs710jpfn7ngy5z4c6rrwwjq33b2a0y-git-2.42.0/bin/git config user.name "${GITLAB_USER_NAME:-"Gitlab CI"}"
- /nix/store/zrs710jpfn7ngy5z4c6rrwwjq33b2a0y-git-2.42.0/bin/git config credential.helper '!f() { echo "username=gitlab-ci-token"; echo "password=${CI_JOB_TOKEN}"; }; f'
- /nix/store/zrs710jpfn7ngy5z4c6rrwwjq33b2a0y-git-2.42.0/bin/git config pull.rebase true
- /nix/store/zrs710jpfn7ngy5z4c6rrwwjq33b2a0y-git-2.42.0/bin/git config http.sslVerify "false"
- /nix/store/zrs710jpfn7ngy5z4c6rrwwjq33b2a0y-git-2.42.0/bin/git remote set-url origin https://pad:${GITLAB_TOKEN}@${CI_REPOSITORY_URL#*@}
- /nix/store/zrs710jpfn7ngy5z4c6rrwwjq33b2a0y-git-2.42.0/bin/git fetch --all --tags --unshallow
- /nix/store/zrs710jpfn7ngy5z4c6rrwwjq33b2a0y-git-2.42.0/bin/git reset --hard origin/master
- /nix/store/zrs710jpfn7ngy5z4c6rrwwjq33b2a0y-git-2.42.0/bin/git checkout $CI_COMMIT_REF_NAME
- /nix/store/zrs710jpfn7ngy5z4c6rrwwjq33b2a0y-git-2.42.0/bin/git pull origin $CI_COMMIT_REF_NAME
- /nix/store/55i9ylml0w72j6qy33izic8ch14rslb0-version/bin/version auto --git --verbose
- /nix/store/zrs710jpfn7ngy5z4c6rrwwjq33b2a0y-git-2.42.0/bin/git push origin $CI_COMMIT_REF_NAME
only:
## regex to x.y branches and master
- master
......@@ -45,60 +41,12 @@ release:
stage: release
image:
name: goreleaser/goreleaser
entrypoint: ['']
entrypoint: [\'\']
only:
- tags
variables:
# Disable shallow cloning so that goreleaser can diff between tags to
GIT_DEPTH: 0
script:
- goreleaser release --clean
#before_script:
# - nix shell nixpkgs#coreutils-full -c mkdir -p /certs/client/
# - nix shell nixpkgs#coreutils-full -c ln -fs /etc/ssl/certs/ca-bundle.crt /certs/client/ca.pem
# - echo > .env-gitlab-ci
# - variables=("HOME=$HOME" "CI_COMMIT_REF_NAME=$CI_COMMIT_REF_NAME" "CI_REPOSITORY_URL=$CI_REPOSITORY_URL" "GITLAB_TOKEN=$GITLAB_TOKEN" "CI_JOB_TOKEN=$CI_JOB_TOKEN" "GITLAB_USER_EMAIL=$GITLAB_USER_EMAIL" "GITLAB_USER_NAME=\"$GITLAB_USER_NAME\"" "CI_REGISTRY_USER=$CI_REGISTRY_USER" "CI_PROJECT_ID=$CI_PROJECT_ID" "CI_PROJECT_DIR=$CI_PROJECT_DIR" "CI_API_V4_URL=$CI_API_V4_URL" "CI_PROJECT_NAME=$CI_PROJECT_NAME" "CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA"); for var in "${variables[@]}"; do echo "$var" >> .env-gitlab-ci; done
# - cat .env-gitlab-ci
#
#after_script:
# - if [ -f .env-gitlab-ci ]; then rm .env-gitlab-ci; fi
#
#build:
# stage: build
# tags:
# - nixos
# script:
# - devenv shell build-app
#
# cache:
# - key: nixos
# paths:
# - /nix/store
#
# artifacts:
# paths:
# - dist
#
#deploy:
# stage: deploy
# tags:
# - nixos
# script:
# - devenv shell -c deploy-app
#
# when: on_success
#
# cache:
# - key: nixos
# paths:
# - /nix/store
#
#
# artifacts:
# paths:
# - dist
- /nix/store/cgzhkcv3wvcd2zlblv4y0vhjvw479467-goreleaser-1.22.1/bin/goreleaser release --clean
......@@ -36,6 +36,64 @@ tasks:
'';
};
gitlabCiYaml = pkgs.writeTextFile {
name = ".gitlab-ci.yml";
text = ''
image: docker-registry.schukai.com:443/nixos-ci-devenv:latest
services:
- docker:dind
variables:
NIXOS_VERSION: "23.05"
NIXPKGS_ALLOW_UNFREE: "1"
NIXPKGS_ALLOW_INSECURE: "1"
DOCKER_DRIVER: overlay2
stages:
- tag
- release
tag-it:
stage: tag
script:
- ${pkgs.git}/bin/git config user.email "''${GITLAB_USER_EMAIL}"
- ${pkgs.git}/bin/git config user.name "''${GITLAB_USER_NAME:-"Gitlab CI"}"
- ${pkgs.git}/bin/git config credential.helper '!f() { echo "username=gitlab-ci-token"; echo "password=''${CI_JOB_TOKEN}"; }; f'
- ${pkgs.git}/bin/git config pull.rebase true
- ${pkgs.git}/bin/git config http.sslVerify "false"
- ${pkgs.git}/bin/git remote set-url origin https://pad:''${GITLAB_TOKEN}@''${CI_REPOSITORY_URL#*@}
- ${pkgs.git}/bin/git fetch --all --tags --unshallow
- ${pkgs.git}/bin/git reset --hard origin/master
- ${pkgs.git}/bin/git checkout $CI_COMMIT_REF_NAME
- ${pkgs.git}/bin/git pull origin $CI_COMMIT_REF_NAME
- ${inputs.version.defaultPackage."${builtins.currentSystem}"}/bin/version auto --git --verbose
- ${pkgs.git}/bin/git push origin $CI_COMMIT_REF_NAME
only:
## regex to x.y branches and master
- master
except:
- tags
release:
stage: release
image:
name: goreleaser/goreleaser
entrypoint: [\'\']
only:
- tags
variables:
# Disable shallow cloning so that goreleaser can diff between tags to
GIT_DEPTH: 0
script:
- ${pkgs.goreleaser}/bin/goreleaser release --clean
'';
};
goReleaserYaml = pkgs.writeTextFile {
......@@ -197,6 +255,8 @@ builds:
# Usage for Taskfile.yaml
update_symlink "${config.devenv.root}/Taskfile.yaml" "${taskfileYaml}"
update_symlink "${config.devenv.root}/.goreleaser.yml" "${goReleaserYaml}"
cat ${gitlabCiYaml} > "${config.devenv.root}/.gitlab-ci.yml"
'';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment