Skip to content

Commit

Permalink
build: updated ci/cd
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMysterius committed Jan 30, 2023
1 parent af6b8c7 commit 1dc4e4e
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -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}"

0 comments on commit 1dc4e4e

Please sign in to comment.