From 1dc4e4ebb4077d3e3e36f9311f4d4735f310054e Mon Sep 17 00:00:00 2001 From: Mr Mysterius Date: Mon, 30 Jan 2023 08:51:19 +0000 Subject: [PATCH] build: updated ci/cd --- .gitlab-ci.yml | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..96fcfae --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,64 @@ +stages: + - build + - upload + - release + +variables: + WINDOWS_EXE: "mangasee-dl.exe" + LINUX_BIN: "mangasee-dl" + PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/release/${CI_COMMIT_TAG}" + +build: + stage: build + image: denoland/deno:latest + artifacts: + paths: + - ./mangasee-dl + - ./mangasee-dl.exe + expire_in: 1 week + before_script: + - apt update + - apt install --yes unzip + script: + - sh build_linux.sh + - sh build_windows.sh + +upload: + stage: upload + image: curlimages/curl:latest + needs: + - job: build + artifacts: true + rules: + - if: $CI_COMMIT_TAG + script: + - echo "${PACKAGE_REGISTRY_URL}/${WINDOWS_EXE}" + - 'curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file ./${WINDOWS_EXE} "${PACKAGE_REGISTRY_URL}/${WINDOWS_EXE}"' + - echo "${PACKAGE_REGISTRY_URL}/${LINUX_BIN}" + - 'curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file ./${LINUX_BIN} "${PACKAGE_REGISTRY_URL}/${LINUX_BIN}"' + +release: + stage: release + image: registry.gitlab.com/gitlab-org/release-cli:latest + needs: + - job: upload + artifacts: false + rules: + - if: $CI_COMMIT_TAG # Run this job when a tag is created manually + script: + - echo "running release_job for $CI_COMMIT_TAG" + - > + release-cli create --name "Version ${CI_COMMIT_TAG}" + --tag-name $CI_COMMIT_TAG + --description "${CI_COMMIT_MESSAGE} - Created using the release-cli ${EXTRA_DESCRIPTION}" + --assets-link "[{\"name\":\"${WINDOWS_EXE}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${WINDOWS_EXE}\"},{\"name\":\"${LINUX_BIN}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${LINUX_BIN}\"}]" + # release: + # name: "Version $CI_COMMIT_TAG" + # description: "$CI_COMMIT_MESSAGE \nCreated using the release-cli $EXTRA_DESCRIPTION" # $EXTRA_DESCRIPTION must be defined + # tag_name: "$CI_COMMIT_TAG" # elsewhere in the pipeline. + # ref: "$CI_COMMIT_TAG" + # assets: + # links: + # - name: "${RELEASE_FILE}" + # url: "${PACKAGE_REGISTRY_URL}/${RELEASE_FILE}" +