👷 create CI script for gitlab
This commit is contained in:
40
.gitlab-ci.yml
Normal file
40
.gitlab-ci.yml
Normal file
@ -0,0 +1,40 @@
|
||||
stages:
|
||||
- build
|
||||
- release
|
||||
|
||||
variables:
|
||||
BUN_VERSION: "1.2.17"
|
||||
|
||||
build_app:
|
||||
stage: build
|
||||
image: oven/bun:${BUN_VERSION}
|
||||
script:
|
||||
- bun i
|
||||
- bun build --compile --minify-whitespace --minify-syntax --target bun --outfile "server-compiled" ./src/index.ts
|
||||
artifacts:
|
||||
paths:
|
||||
- server-compiled
|
||||
expire_in: 1 hour
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "main"'
|
||||
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main"'
|
||||
|
||||
create_release:
|
||||
stage: release
|
||||
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
||||
needs:
|
||||
- job: build_app
|
||||
artifacts: true
|
||||
script:
|
||||
- echo "Creating release and uploading server-compiled..."
|
||||
release:
|
||||
name: "Release $CI_COMMIT_TAG"
|
||||
tag_name: "$CI_COMMIT_TAG"
|
||||
description: "Automated release for commit $CI_COMMIT_SHA"
|
||||
assets:
|
||||
links:
|
||||
- name: "server-compiled"
|
||||
url: "${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/server-compiled"
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "main"'
|
||||
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main"'
|
||||
Reference in New Issue
Block a user