ryzen-controller/.gitlab-ci.yml
Quentin “Storm1er” Decaunes dde50c9cad chore: Update dependencies.
2021-08-30 11:55:04 +02:00

277 lines
7.9 KiB
YAML

include:
- template: Dependency-Scanning.gitlab-ci.yml
- template: SAST.gitlab-ci.yml
- template: Code-Quality.gitlab-ci.yml
stages:
- test
- install
- build
- installer
- release-note
- release
###############################################################################
## TEST
###############################################################################
# See https://gitlab.com/ryzen-controller-team/ryzen-controller/-/pipelines/156178573
# code_quality:
# stage: test
# only:
# - branches
# - schedules@ryzen-controller-team/ryzen-controller
# except: []
# See https://gitlab.com/ryzen-controller-team/ryzen-controller/-/pipelines/156177371
# dependency_scanning:
# stage: test
# only:
# - branches
# - schedules@ryzen-controller-team/ryzen-controller
# except: []
# See https://gitlab.com/ryzen-controller-team/ryzen-controller/-/pipelines/156178280
# sast:
# stage: test
# only:
# - branches
# - schedules@ryzen-controller-team/ryzen-controller
# except: []
release-check:
tags: [ docker ]
image: registry.gitlab.com/juhani/go-semrel-gitlab:v0.20.4
only:
- branches
- schedules@ryzen-controller-team/ryzen-controller
stage: test
script:
- release next-version > .next_version
- cat .next_version
artifacts:
paths:
- .next_version
###############################################################################
## INSTALL
###############################################################################
node:
only:
- branches
- schedules@ryzen-controller-team/ryzen-controller
stage: install
tags: [ docker ]
image: storm1er/electron-builder-wine-dubnium:1.0.3
needs:
- release-check
script:
- VERSION=`cat .next_version`
- yarn config set version-git-tag false
- yarn version --new-version "${VERSION}"
- yarn install --frozen-lockfile
cache:
paths:
- node_modules/
artifacts:
paths:
- node_modules/
- package.json
###############################################################################
## BUILD
###############################################################################
build:
only:
- branches
- schedules@ryzen-controller-team/ryzen-controller
stage: build
tags: [ docker ]
image: storm1er/electron-builder-wine-dubnium:1.0.3
script:
- yarn build
artifacts:
paths:
- build/
needs:
- node
###############################################################################
## INSTALLER
###############################################################################
installers:
only:
- branches
- schedules@ryzen-controller-team/ryzen-controller
stage: installer
tags: [ docker ]
image: storm1er/electron-builder-wine-dubnium:1.0.3
script:
- export ELECTRON_CACHE=`pwd`/.cache/electron
- export ELECTRON_BUILDER_CACHE=`pwd`/.cache/builder
- mkdir -p `pwd`/.cache/electron
- mkdir -p `pwd`/.cache/builder
- yarn dist-pack:all
- mkdir dist/win
- mkdir dist/rpm
- mkdir dist/deb
- mv dist/*.exe dist/win/
- mv dist/*.rpm dist/rpm/
- mv dist/*.deb dist/deb/
- echo "https://gitlab.com/ryzen-controller-team/ryzen-controller/-/jobs/${CI_JOB_ID}/artifacts/browse/dist/win/" > .exe_link
- echo "https://gitlab.com/ryzen-controller-team/ryzen-controller/-/jobs/${CI_JOB_ID}/artifacts/browse/dist/rpm/" > .rpm_link
- echo "https://gitlab.com/ryzen-controller-team/ryzen-controller/-/jobs/${CI_JOB_ID}/artifacts/browse/dist/deb/" > .deb_link
cache:
paths:
- .cache
artifacts:
paths:
- dist/win
- dist/rpm
- dist/deb
- .exe_link
- .rpm_link
- .deb_link
expire_in: never
needs:
- node
- build
###############################################################################
## RELEASE-NOTE
###############################################################################
create-rpm-link:
tags: [ docker ]
image: alpine
stage: release-note
needs:
- installers
- release-check
only:
- schedules@ryzen-controller-team/ryzen-controller
before_script:
- apk add curl jq
script:
- URL=`cat .rpm_link`
- VERSION=`cat .next_version`
- VERSION_ESCAPED=`echo $VERSION | tr '.' '-'`
- curl -H "Content-Type:application/json"
-X POST
-H "Authorization:Bearer ${BL_TOKEN}"
-d "{\"title\":\"${VERSION} rpm\",\"tags\":[\"RC_rpm\",\"RC_${VERSION_ESCAPED}\",\"RC\",\"tmp\"],\"long_url\":\"${URL}\",\"group_guid\":\"Bj4p9bnMV93\"}"
"https://api-ssl.bitly.com/v4/bitlinks" > .rpm_res.json
- cat .rpm_res.json | jq -e -r .link > .rpm_short_link
- cat .rpm_short_link
artifacts:
when: always
paths:
- .rpm_short_link
- .rpm_res.json
create-deb-link:
tags: [ docker ]
image: alpine
stage: release-note
needs:
- installers
- release-check
only:
- schedules@ryzen-controller-team/ryzen-controller
before_script:
- apk add curl jq
script:
- URL=`cat .deb_link`
- VERSION=`cat .next_version`
- VERSION_ESCAPED=`echo $VERSION | tr '.' '-'`
- curl -H "Content-Type:application/json"
-X POST
-H "Authorization:Bearer ${BL_TOKEN}"
-d "{\"title\":\"${VERSION} deb\",\"tags\":[\"RC_deb\",\"RC_${VERSION_ESCAPED}\",\"RC\",\"tmp\"],\"long_url\":\"${URL}\",\"group_guid\":\"Bj4p9bnMV93\"}"
"https://api-ssl.bitly.com/v4/bitlinks" > .deb_res.json
- cat .deb_res.json | jq -e -r .link > .deb_short_link
- cat .deb_short_link
artifacts:
when: always
paths:
- .deb_short_link
- .deb_res.json
create-exe-link:
tags: [ docker ]
image: alpine
stage: release-note
needs:
- installers
- release-check
only:
- schedules@ryzen-controller-team/ryzen-controller
before_script:
- apk add curl jq
script:
- URL=`cat .exe_link`
- VERSION=`cat .next_version`
- VERSION_ESCAPED=`echo $VERSION | tr '.' '-'`
- curl -H "Content-Type:application/json"
-X POST
-H "Authorization:Bearer ${BL_TOKEN}"
-d "{\"title\":\"${VERSION} exe\",\"tags\":[\"RC_exe\",\"RC_${VERSION_ESCAPED}\",\"RC\",\"tmp\"],\"long_url\":\"${URL}\",\"group_guid\":\"Bj4p9bnMV93\"}"
"https://api-ssl.bitly.com/v4/bitlinks" > .exe_res.json
- cat .exe_res.json | jq -e -r .link > .exe_short_link
- cat .exe_short_link
artifacts:
when: always
paths:
- .exe_short_link
- .exe_res.json
update-changelog:
tags: [ docker ]
image: registry.gitlab.com/juhani/go-semrel-gitlab:v0.20.4
only:
- schedules@ryzen-controller-team/ryzen-controller
stage: release-note
script:
- release changelog
artifacts:
paths:
- CHANGELOG.md
###############################################################################
## RELEASE
###############################################################################
publish:
tags: [ docker ]
image: registry.gitlab.com/juhani/go-semrel-gitlab:v0.20.4
only:
- schedules@ryzen-controller-team/ryzen-controller
stage: release
needs:
- release-check
- node
- create-rpm-link
- create-deb-link
- create-exe-link
- update-changelog
script:
- VERSION=`cat .next_version`
- release --ci-commit-tag ${VERSION} commit-and-tag CHANGELOG.md package.json
- release --ci-commit-tag ${VERSION} add-download-link -d "Debian installer (and variant)" -n "ryzencontroller_${VERSION}_amd64.deb" -u "`cat .deb_short_link`"
- release --ci-commit-tag ${VERSION} add-download-link -d "Redhat installer (and variant)" -n "ryzencontroller_${VERSION}.amd64.rpm" -u "`cat .rpm_short_link`"
- release --ci-commit-tag ${VERSION} add-download-link -d "Windows installer" -n "RyzenControllerInstaller.exe" -u "`cat .exe_short_link`"
no-publish:
tags: [ docker ]
image: registry.gitlab.com/juhani/go-semrel-gitlab:v0.20.4
only:
- schedules@ryzen-controller-team/ryzen-controller
stage: release
when: on_failure
dependencies: []
script:
- echo "Publish step not needed."