forked from hamcha/tghandbook
153 lines
3.1 KiB
YAML
153 lines
3.1 KiB
YAML
---
|
|
kind: pipeline
|
|
name: default
|
|
|
|
steps:
|
|
- name: restore-cache
|
|
image: drillster/drone-volume-cache
|
|
volumes:
|
|
- name: cache
|
|
path: /cache
|
|
settings:
|
|
restore: true
|
|
mount:
|
|
- ./node_modules
|
|
|
|
- name: dependencies
|
|
image: node
|
|
failure: ignore
|
|
commands:
|
|
- yarn
|
|
depends_on:
|
|
- restore-cache
|
|
|
|
- name: lint
|
|
image: node
|
|
commands:
|
|
- yarn lint
|
|
depends_on:
|
|
- dependencies
|
|
|
|
- name: build_versioned
|
|
image: node
|
|
commands:
|
|
- yarn build
|
|
environment:
|
|
VITE_SUBPATH: /tghandbook/${DRONE_COMMIT_BRANCH/\//_}-${DRONE_COMMIT_SHA:0:8}
|
|
VITE_APP_REVISION: ${DRONE_COMMIT_SHA}
|
|
when:
|
|
event:
|
|
- push
|
|
depends_on:
|
|
- dependencies
|
|
|
|
- name: build_pr
|
|
image: node
|
|
commands:
|
|
- yarn build
|
|
environment:
|
|
VITE_SUBPATH: /tghandbook/pr-${DRONE_PULL_REQUEST}
|
|
OUTDIR: ./dist-pr
|
|
VITE_APP_REVISION: ${DRONE_COMMIT_SHA}
|
|
when:
|
|
event:
|
|
- pull_request
|
|
depends_on:
|
|
- dependencies
|
|
|
|
- name: build_branch
|
|
image: node
|
|
commands:
|
|
- yarn build
|
|
environment:
|
|
VITE_SUBPATH: /tghandbook/${DRONE_COMMIT_BRANCH/\//_}
|
|
OUTDIR: ./dist-branch
|
|
VITE_APP_REVISION: ${DRONE_COMMIT_SHA}
|
|
when:
|
|
event:
|
|
- push
|
|
depends_on:
|
|
- dependencies
|
|
|
|
- name: upload_build_versioned
|
|
image: plugins/s3
|
|
settings:
|
|
bucket: tghandbook
|
|
access_key:
|
|
from_secret: minio_access
|
|
secret_key:
|
|
from_secret: minio_secret
|
|
source: dist/**/*
|
|
target: /${DRONE_COMMIT_BRANCH/\//_}-${DRONE_COMMIT_SHA:0:8}/
|
|
strip_prefix: dist/
|
|
path_style: true
|
|
endpoint: https://artifacts.fromouter.space
|
|
when:
|
|
event:
|
|
- push
|
|
depends_on:
|
|
- build_versioned
|
|
|
|
- name: upload_build_pr
|
|
image: plugins/s3
|
|
settings:
|
|
bucket: tghandbook
|
|
access_key:
|
|
from_secret: minio_access
|
|
secret_key:
|
|
from_secret: minio_secret
|
|
source: dist-pr/**/*
|
|
target: /pr-${DRONE_PULL_REQUEST}/
|
|
strip_prefix: dist-pr/
|
|
path_style: true
|
|
endpoint: https://artifacts.fromouter.space
|
|
when:
|
|
event:
|
|
- pull_request
|
|
depends_on:
|
|
- build_pr
|
|
|
|
- name: upload_build_branch
|
|
image: plugins/s3
|
|
settings:
|
|
bucket: tghandbook
|
|
access_key:
|
|
from_secret: minio_access
|
|
secret_key:
|
|
from_secret: minio_secret
|
|
source: dist-branch/**/*
|
|
target: /${DRONE_COMMIT_BRANCH/\//_}/
|
|
strip_prefix: dist-branch/
|
|
path_style: true
|
|
endpoint: https://artifacts.fromouter.space
|
|
when:
|
|
event:
|
|
- push
|
|
depends_on:
|
|
- build_branch
|
|
|
|
- name: rebuild-cache
|
|
image: drillster/drone-volume-cache
|
|
failure: ignore
|
|
volumes:
|
|
- name: cache
|
|
path: /cache
|
|
settings:
|
|
rebuild: true
|
|
mount:
|
|
- ./node_modules
|
|
depends_on:
|
|
- dependencies
|
|
|
|
volumes:
|
|
- name: cache
|
|
host:
|
|
path: /opt/gitea/drone-cache/hamcha/tghandbook
|
|
|
|
trigger:
|
|
event:
|
|
- push
|
|
- pull_request
|
|
---
|
|
kind: signature
|
|
hmac: c7b6e232691aff687451a9f85599852d4af0e3b63198c41116be4e09e7d82e93
|