ci: DRY
All checks were successful
ci/woodpecker/push/cd Pipeline was successful

This commit is contained in:
bdeshi 2024-05-20 22:14:21 +06:00
parent d2a062c1bd
commit d4455cdd2a
Signed by: bdeshi
GPG Key ID: 410D03DA9A3468E0

View File

@ -4,6 +4,7 @@ when:
event: [push, manual] event: [push, manual]
variables: variables:
secrets: &secrets secrets: &secrets
- S3_BUCKET - S3_BUCKET
- CLOUDFRONT_DISTRIBUTION - CLOUDFRONT_DISTRIBUTION
@ -11,28 +12,35 @@ variables:
- AWS_SECRET_ACCESS_KEY - AWS_SECRET_ACCESS_KEY
- AWS_REGION - AWS_REGION
cache: &cache_step
steps:
- name: cache/restore
image: meltwater/drone-cache:v1.4.0 image: meltwater/drone-cache:v1.4.0
environment: environment:
AWS_ACCESS_KEY_ID: AWS_ACCESS_KEY_ID:
from_secret: CACHE_S3_ACCESS_KEY_ID from_secret: CACHE_S3_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: AWS_SECRET_ACCESS_KEY:
from_secret: CACHE_S3_SECRET_ACCESS_KEY from_secret: CACHE_S3_SECRET_ACCESS_KEY
cache_settings: &cache_step_settings
path_style: true
cache_key: '{{ .Commit.Branch }}-{{ checksum "yarn.lock" }}'
archive_format: zstd
bucket:
from_secret: CACHE_S3_BUCKET
endpoint:
from_secret: CACHE_S3_ENDPOINT
region:
from_secret: CACHE_S3_REGION
mount:
- 'node_modules'
steps:
- name: cache/restore
<<: *cache_step
settings: settings:
<<: *cache_step_settings
restore: true restore: true
path_style: true
cache_key: '{{ .Commit.Branch }}-{{ checksum "yarn.lock" }}'
archive_format: zstd
bucket:
from_secret: CACHE_S3_BUCKET
endpoint:
from_secret: CACHE_S3_ENDPOINT
region:
from_secret: CACHE_S3_REGION
mount:
- 'node_modules'
- name: build/yarn - name: build/yarn
depends_on: [ cache/restore ] depends_on: [ cache/restore ]
@ -43,25 +51,11 @@ steps:
- name: cache/rebuild - name: cache/rebuild
depends_on: [ build/yarn ] depends_on: [ build/yarn ]
image: meltwater/drone-cache:v1.4.0 <<: *cache_step
environment:
AWS_ACCESS_KEY_ID:
from_secret: CACHE_S3_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY:
from_secret: CACHE_S3_SECRET_ACCESS_KEY
settings: settings:
<<: *cache_step_settings
rebuild: true rebuild: true
path_style: true
cache_key: '{{ .Commit.Branch }}-{{ checksum "yarn.lock" }}'
archive_format: zstd
bucket:
from_secret: CACHE_S3_BUCKET
endpoint:
from_secret: CACHE_S3_ENDPOINT
region:
from_secret: CACHE_S3_REGION
mount:
- 'node_modules'
- name: publish/s3 - name: publish/s3
depends_on: [ build/yarn ] depends_on: [ build/yarn ]