improve pipeline
This commit is contained in:
parent
d11a7af642
commit
47328f0eac
1 changed files with 63 additions and 9 deletions
|
@ -8,17 +8,17 @@ image: node:lts
|
||||||
stages:
|
stages:
|
||||||
- test
|
- test
|
||||||
- build
|
- build
|
||||||
|
- publish
|
||||||
- release
|
- release
|
||||||
|
|
||||||
before_script:
|
|
||||||
- yarn install --immutable
|
|
||||||
|
|
||||||
cache: &global_cache
|
cache: &global_cache
|
||||||
paths:
|
paths:
|
||||||
- .yarn/cache
|
- .yarn/cache
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
stage: test
|
stage: test
|
||||||
|
before_script:
|
||||||
|
- yarn install --immutable
|
||||||
script:
|
script:
|
||||||
- yarn lint
|
- yarn lint
|
||||||
cache:
|
cache:
|
||||||
|
@ -26,6 +26,8 @@ lint:
|
||||||
|
|
||||||
test:
|
test:
|
||||||
stage: test
|
stage: test
|
||||||
|
before_script:
|
||||||
|
- yarn install --immutable
|
||||||
script:
|
script:
|
||||||
- yarn test:ci
|
- yarn test:ci
|
||||||
cache:
|
cache:
|
||||||
|
@ -41,12 +43,13 @@ reuse:
|
||||||
image:
|
image:
|
||||||
name: fsfe/reuse:latest
|
name: fsfe/reuse:latest
|
||||||
entrypoint: [""]
|
entrypoint: [""]
|
||||||
before_script: []
|
|
||||||
script:
|
script:
|
||||||
- reuse lint
|
- reuse lint
|
||||||
|
|
||||||
build:
|
build:
|
||||||
stage: build
|
stage: build
|
||||||
|
before_script:
|
||||||
|
- yarn install --immutable
|
||||||
script:
|
script:
|
||||||
- yarn build
|
- yarn build
|
||||||
- mv dist ds4
|
- mv dist ds4
|
||||||
|
@ -77,14 +80,27 @@ build:
|
||||||
git add package.json src/system.json
|
git add package.json src/system.json
|
||||||
git --no-pager diff
|
git --no-pager diff
|
||||||
git commit -m "release version ${RELEASE_VERSION}"
|
git commit -m "release version ${RELEASE_VERSION}"
|
||||||
git tag -f latest
|
|
||||||
git tag -f ${RELEASE_VERSION}
|
git tag -f ${RELEASE_VERSION}
|
||||||
git push origin ci-processing:${CI_BUILD_REF_NAME}
|
git push origin ci-processing:${CI_BUILD_REF_NAME}
|
||||||
git push origin latest -f
|
|
||||||
git push origin ${RELEASE_VERSION}
|
git push origin ${RELEASE_VERSION}
|
||||||
only:
|
rules:
|
||||||
- master
|
- if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH"
|
||||||
when: manual
|
when: manual
|
||||||
|
|
||||||
|
publish-artifacts:
|
||||||
|
image: alpine:latest
|
||||||
|
stage: publish
|
||||||
|
before_script:
|
||||||
|
- apk update
|
||||||
|
- apk add zip curl
|
||||||
|
script: |
|
||||||
|
zip ds4.zip ds4
|
||||||
|
curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ds4.zip "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/ds4/$CI_COMMIT_TAG/ds4.zip"
|
||||||
|
curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ds4/system.json "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/ds4/$CI_COMMIT_TAG/system.json"
|
||||||
|
curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ds4/system.json "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/ds4/latest/system.json"
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_TAG
|
||||||
|
when: manual
|
||||||
|
|
||||||
release-patch:
|
release-patch:
|
||||||
variables:
|
variables:
|
||||||
|
@ -100,3 +116,41 @@ release-major:
|
||||||
variables:
|
variables:
|
||||||
RELEASE_TYPE: major
|
RELEASE_TYPE: major
|
||||||
<<: *release-template
|
<<: *release-template
|
||||||
|
|
||||||
|
bump-latest-tag:
|
||||||
|
stage: release
|
||||||
|
before_script:
|
||||||
|
- REPOSITORY_URL=$(echo "${CI_REPOSITORY_URL}" | sed -e "s|gitlab-ci-token:.*@|${RELEASE_TOKEN}:${RELEASE_TOKEN_SECRET}@|g")
|
||||||
|
- git remote set-url origin $REPOSITORY_URL
|
||||||
|
- git config user.name $GITLAB_USER_LOGIN
|
||||||
|
- git config user.email $GITLAB_USER_EMAIL
|
||||||
|
script: |
|
||||||
|
git tag -f latest
|
||||||
|
git push origin latest -f
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_TAG
|
||||||
|
when: manual
|
||||||
|
- if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/'
|
||||||
|
|
||||||
|
release:
|
||||||
|
stage: release
|
||||||
|
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
||||||
|
script:
|
||||||
|
- echo 'release job'
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_TAG
|
||||||
|
when: manual
|
||||||
|
- if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/'
|
||||||
|
release:
|
||||||
|
tag_name: $CI_COMMIT_TAG
|
||||||
|
description: $CI_COMMIT_TAG
|
||||||
|
assets:
|
||||||
|
links:
|
||||||
|
- name: "ds4.zip"
|
||||||
|
url: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/ds4/$CI_COMMIT_TAG/ds4.zip"
|
||||||
|
link_type: package
|
||||||
|
filepath: ds4.zip
|
||||||
|
- name: "system.json"
|
||||||
|
url: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/ds4/$CI_COMMIT_TAG/system.json"
|
||||||
|
link_type: runbook
|
||||||
|
filepath: system.json
|
||||||
|
|
Loading…
Add table
Reference in a new issue