2018-11-06 10:30:27 +01:00
|
|
|
image: tcitworld/mobilizon-ci
|
2018-01-13 23:35:11 +01:00
|
|
|
|
2018-12-18 12:26:10 +01:00
|
|
|
stages:
|
2020-12-23 00:01:25 +01:00
|
|
|
- install
|
2019-10-05 21:17:18 +02:00
|
|
|
- check
|
2021-01-14 15:47:35 +01:00
|
|
|
- build-js
|
2019-10-05 21:17:18 +02:00
|
|
|
- test
|
2021-01-14 15:47:35 +01:00
|
|
|
- docker
|
2020-12-23 00:01:25 +01:00
|
|
|
- package
|
|
|
|
- upload
|
2019-03-18 12:37:04 +01:00
|
|
|
- deploy
|
2018-01-13 23:35:11 +01:00
|
|
|
|
2018-01-13 23:40:06 +01:00
|
|
|
variables:
|
|
|
|
MIX_ENV: "test"
|
2020-12-23 00:01:25 +01:00
|
|
|
YARN_CACHE_FOLDER: "js/.yarn"
|
2019-01-03 11:33:52 +01:00
|
|
|
# DB Variables for Postgres / Postgis
|
2018-10-11 17:37:39 +02:00
|
|
|
POSTGRES_DB: mobilizon_test
|
2018-01-14 00:21:20 +01:00
|
|
|
POSTGRES_USER: postgres
|
2021-06-07 17:41:50 +02:00
|
|
|
POSTGRES_PASSWORD: postgres
|
2018-01-14 00:47:03 +01:00
|
|
|
POSTGRES_HOST: postgres
|
2019-01-03 11:33:52 +01:00
|
|
|
# DB Variables for Mobilizon
|
|
|
|
MOBILIZON_DATABASE_USERNAME: $POSTGRES_USER
|
|
|
|
MOBILIZON_DATABASE_PASSWORD: $POSTGRES_PASSWORD
|
|
|
|
MOBILIZON_DATABASE_DBNAME: $POSTGRES_DB
|
|
|
|
MOBILIZON_DATABASE_HOST: $POSTGRES_HOST
|
2018-12-18 11:24:22 +01:00
|
|
|
GEOLITE_CITIES_PATH: "/usr/share/GeoIP/GeoLite2-City.mmdb"
|
2019-10-05 19:07:50 +02:00
|
|
|
MOBILIZON_INSTANCE_REGISTRATIONS_OPEN: "true"
|
2020-12-21 16:56:38 +01:00
|
|
|
# Release elements
|
2020-12-23 00:01:25 +01:00
|
|
|
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}"
|
2021-01-13 09:05:39 +01:00
|
|
|
ARCH: "amd64"
|
2021-10-04 18:59:41 +02:00
|
|
|
EXPORT_FORMATS: "csv,ods,pdf"
|
2021-10-21 12:00:38 +02:00
|
|
|
APP_VERSION: "${CI_COMMIT_REF_NAME}"
|
|
|
|
APP_ASSET: "${CI_PROJECT_NAME}_${CI_COMMIT_REF_NAME}_${ARCH}.tar.gz"
|
|
|
|
CYPRESS_INSTALL_BINARY: 0
|
2022-04-07 11:20:52 +02:00
|
|
|
HEX_MIRROR: https://cdn.jsdelivr.net/hex
|
2020-12-21 16:56:38 +01:00
|
|
|
|
2019-10-07 10:59:21 +02:00
|
|
|
cache:
|
2021-01-13 09:05:39 +01:00
|
|
|
key: "${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA}"
|
2019-10-07 10:59:21 +02:00
|
|
|
paths:
|
2019-10-07 11:27:06 +02:00
|
|
|
- ~/.cache/Cypress
|
2020-12-23 00:01:25 +01:00
|
|
|
- cache/Cypress
|
2019-10-07 10:59:21 +02:00
|
|
|
- deps/
|
2020-12-23 00:01:25 +01:00
|
|
|
- _build/
|
2019-10-07 10:59:21 +02:00
|
|
|
- js/node_modules
|
2020-12-23 00:01:25 +01:00
|
|
|
- js/.yarn
|
|
|
|
|
|
|
|
# Installed dependencies are cached across the pipeline
|
|
|
|
# So there is no need to reinstall them all the time
|
|
|
|
# It saves minutes during a pipeline build time
|
|
|
|
install:
|
|
|
|
stage: install
|
|
|
|
script:
|
2021-01-12 19:47:10 +01:00
|
|
|
- yarn --cwd "js" install --frozen-lockfile
|
|
|
|
- mix deps.get
|
|
|
|
- mix compile
|
2019-10-07 10:59:21 +02:00
|
|
|
|
2021-01-11 13:58:40 +01:00
|
|
|
lint-elixir:
|
2019-10-05 21:17:18 +02:00
|
|
|
stage: check
|
2021-01-14 15:07:59 +01:00
|
|
|
before_script:
|
|
|
|
- mix deps.get
|
2019-03-22 11:37:58 +01:00
|
|
|
script:
|
2019-10-07 10:59:21 +02:00
|
|
|
- export EXITVALUE=0
|
2022-01-18 14:17:48 +01:00
|
|
|
- git fetch origin ${CI_DEFAULT_BRANCH}
|
|
|
|
- TARGET_SHA1=$(git show-ref -s ${CI_DEFAULT_BRANCH})
|
|
|
|
- echo "$TARGET_SHA1"
|
2019-10-07 10:59:21 +02:00
|
|
|
- mix format --check-formatted --dry-run || export EXITVALUE=1
|
2022-01-18 14:17:48 +01:00
|
|
|
- mix credo diff --from-git-merge-base $TARGET_SHA1 --strict -a || export EXITVALUE=1
|
2021-01-25 16:31:57 +01:00
|
|
|
- mix sobelow --config || export EXITVALUE=1
|
2021-01-11 13:58:40 +01:00
|
|
|
- exit $EXITVALUE
|
|
|
|
|
|
|
|
lint-front:
|
2021-06-07 17:21:41 +02:00
|
|
|
image: node:16
|
2021-01-11 13:58:40 +01:00
|
|
|
stage: check
|
|
|
|
before_script:
|
|
|
|
- export EXITVALUE=0
|
2021-01-14 15:07:59 +01:00
|
|
|
- yarn --cwd "js" install --frozen-lockfile
|
2021-01-11 13:58:40 +01:00
|
|
|
script:
|
2021-01-14 15:45:10 +01:00
|
|
|
- yarn --cwd "js" run lint || export EXITVALUE=1
|
|
|
|
- yarn --cwd "js" run prettier -c . || export EXITVALUE=1
|
2019-10-07 10:59:21 +02:00
|
|
|
- exit $EXITVALUE
|
2020-12-23 00:01:25 +01:00
|
|
|
|
|
|
|
build-frontend:
|
2021-01-14 15:47:35 +01:00
|
|
|
stage: build-js
|
2021-06-07 17:21:41 +02:00
|
|
|
image: node:16
|
2020-12-23 00:01:25 +01:00
|
|
|
before_script:
|
2021-01-12 19:47:10 +01:00
|
|
|
- apt update
|
|
|
|
- apt install -y --no-install-recommends python build-essential webp imagemagick gifsicle jpegoptim optipng pngquant
|
2020-12-23 00:01:25 +01:00
|
|
|
script:
|
2021-01-14 15:07:59 +01:00
|
|
|
- yarn --cwd "js" install --frozen-lockfile
|
2021-01-12 19:47:10 +01:00
|
|
|
- yarn --cwd "js" run build
|
2019-10-07 10:59:21 +02:00
|
|
|
artifacts:
|
2020-12-23 00:01:25 +01:00
|
|
|
expire_in: 5 days
|
2019-03-22 11:04:57 +01:00
|
|
|
paths:
|
2021-01-12 19:47:10 +01:00
|
|
|
- priv/static
|
2020-12-23 00:01:25 +01:00
|
|
|
needs:
|
2021-01-12 19:47:10 +01:00
|
|
|
- lint-front
|
2019-03-22 11:04:57 +01:00
|
|
|
|
2019-10-05 21:17:18 +02:00
|
|
|
deps:
|
|
|
|
stage: check
|
2021-01-14 15:07:59 +01:00
|
|
|
before_script:
|
|
|
|
- mix deps.get
|
2018-12-18 12:26:10 +01:00
|
|
|
script:
|
2019-10-07 10:59:21 +02:00
|
|
|
- export EXITVALUE=0
|
|
|
|
- mix hex.outdated || export EXITVALUE=1
|
2020-12-23 00:01:25 +01:00
|
|
|
- yarn --cwd "js" outdated || export EXITVALUE=1
|
2019-10-07 10:59:21 +02:00
|
|
|
- exit $EXITVALUE
|
2019-03-08 13:42:34 +01:00
|
|
|
allow_failure: true
|
2020-12-23 00:01:25 +01:00
|
|
|
needs:
|
|
|
|
- install
|
2018-01-13 23:35:11 +01:00
|
|
|
|
2021-06-07 17:21:41 +02:00
|
|
|
exunit:
|
|
|
|
stage: test
|
|
|
|
services:
|
2022-04-06 18:40:22 +02:00
|
|
|
- name: postgis/postgis:14-3.2
|
2021-06-07 17:21:41 +02:00
|
|
|
alias: postgres
|
|
|
|
variables:
|
|
|
|
MIX_ENV: test
|
|
|
|
before_script:
|
2021-10-18 16:05:45 +02:00
|
|
|
- mix deps.get && mix tz_world.update
|
2021-06-07 17:21:41 +02:00
|
|
|
- mix ecto.create
|
2020-12-23 00:01:25 +01:00
|
|
|
- mix ecto.migrate
|
2018-01-13 23:35:11 +01:00
|
|
|
script:
|
2018-12-18 12:26:10 +01:00
|
|
|
- mix coveralls
|
2021-01-12 20:09:44 +01:00
|
|
|
artifacts:
|
|
|
|
when: always
|
|
|
|
reports:
|
|
|
|
junit:
|
|
|
|
- test-junit-report.xml
|
|
|
|
expire_in: 30 days
|
2020-12-02 11:19:39 +01:00
|
|
|
|
|
|
|
jest:
|
|
|
|
stage: test
|
2020-12-23 00:01:25 +01:00
|
|
|
needs:
|
2021-01-11 13:58:40 +01:00
|
|
|
- lint-front
|
2021-01-14 15:07:59 +01:00
|
|
|
before_script:
|
|
|
|
- yarn --cwd "js" install --frozen-lockfile
|
2020-12-02 11:19:39 +01:00
|
|
|
script:
|
2020-12-23 00:01:25 +01:00
|
|
|
- yarn --cwd "js" run test:unit --no-color --ci --reporters=default --reporters=jest-junit
|
2020-12-02 11:19:39 +01:00
|
|
|
artifacts:
|
|
|
|
when: always
|
|
|
|
paths:
|
|
|
|
- js/coverage
|
2020-12-23 00:01:25 +01:00
|
|
|
reports:
|
|
|
|
junit:
|
2021-01-12 19:47:10 +01:00
|
|
|
- js/junit.xml
|
2020-12-02 11:19:39 +01:00
|
|
|
expire_in: 30 days
|
2020-12-23 00:01:25 +01:00
|
|
|
|
2020-06-03 19:04:22 +02:00
|
|
|
# cypress:
|
|
|
|
# stage: test
|
|
|
|
# services:
|
2021-06-07 17:41:50 +02:00
|
|
|
# - name: postgis/postgis:13.3
|
2020-06-03 19:04:22 +02:00
|
|
|
# alias: postgres
|
2020-12-23 00:01:25 +01:00
|
|
|
# variables:
|
|
|
|
# MIX_ENV=e2e
|
2020-06-03 19:04:22 +02:00
|
|
|
# script:
|
2020-12-23 00:01:25 +01:00
|
|
|
# - mix ecto.create
|
|
|
|
# - mix ecto.migrate
|
|
|
|
# - mix run priv/repo/e2e.seed.exs
|
|
|
|
# - mix phx.server &
|
2020-06-03 19:04:22 +02:00
|
|
|
# - cd js
|
|
|
|
# - npx wait-on http://localhost:4000
|
|
|
|
# - if [ -z "$CYPRESS_KEY" ]; then npx cypress run; else npx cypress run --record --parallel --key $CYPRESS_KEY; fi
|
|
|
|
# artifacts:
|
|
|
|
# expire_in: 2 day
|
|
|
|
# paths:
|
|
|
|
# - js/tests/e2e/screenshots/**/*.png
|
|
|
|
# - js/tests/e2e/videos/**/*.mp4
|
2019-10-05 21:17:18 +02:00
|
|
|
|
2021-01-14 15:47:12 +01:00
|
|
|
pages:
|
|
|
|
stage: deploy
|
|
|
|
script:
|
|
|
|
- mkdir public
|
2021-03-09 10:06:54 +01:00
|
|
|
- mix deps.get
|
2021-01-14 15:47:12 +01:00
|
|
|
- mix docs
|
|
|
|
- mv doc public/backend
|
2021-01-14 17:01:44 +01:00
|
|
|
# #- yarn run --cwd "js" styleguide:build
|
|
|
|
# #- mv js/styleguide public/frontend
|
|
|
|
rules:
|
2021-11-09 09:12:04 +01:00
|
|
|
- if: '$CI_COMMIT_BRANCH == "main"'
|
2021-01-14 17:01:44 +01:00
|
|
|
artifacts:
|
|
|
|
expire_in: 1 hour
|
|
|
|
paths:
|
|
|
|
- public
|
2020-11-09 10:04:55 +01:00
|
|
|
|
|
|
|
.docker: &docker
|
2021-01-14 15:47:35 +01:00
|
|
|
stage: docker
|
2022-03-28 10:43:06 +02:00
|
|
|
image: docker:20.10.12
|
2021-10-21 12:00:38 +02:00
|
|
|
variables:
|
|
|
|
DOCKER_TLS_CERTDIR: "/certs"
|
|
|
|
DOCKER_HOST: tcp://docker:2376
|
|
|
|
DOCKER_TLS_VERIFY: 1
|
|
|
|
DOCKER_CERT_PATH: "$DOCKER_TLS_CERTDIR/client"
|
|
|
|
DOCKER_DRIVER: overlay2
|
|
|
|
services:
|
2022-03-28 10:43:06 +02:00
|
|
|
- docker:20.10.12-dind
|
2020-11-09 10:04:55 +01:00
|
|
|
cache: {}
|
2021-11-29 10:38:05 +01:00
|
|
|
before_script:
|
|
|
|
# Install buildx
|
2022-03-24 16:37:03 +01:00
|
|
|
- wget https://github.com/docker/buildx/releases/download/v0.8.1/buildx-v0.8.1.linux-amd64
|
2021-11-29 10:38:05 +01:00
|
|
|
- mkdir -p ~/.docker/cli-plugins/
|
2022-03-24 16:37:03 +01:00
|
|
|
- mv buildx-v0.8.1.linux-amd64 ~/.docker/cli-plugins/docker-buildx
|
2021-11-29 10:38:05 +01:00
|
|
|
- chmod a+x ~/.docker/cli-plugins/docker-buildx
|
|
|
|
# Create env
|
|
|
|
- docker context create tls-environment
|
|
|
|
- docker buildx create --use tls-environment
|
|
|
|
# Install qemu/binfmt
|
|
|
|
- docker pull tonistiigi/binfmt:latest
|
|
|
|
- docker run --rm --privileged tonistiigi/binfmt:latest --install all
|
|
|
|
# Login to DockerHub
|
|
|
|
- mkdir -p ~/.docker
|
|
|
|
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$CI_REGISTRY_AUTH\",\"email\":\"$CI_REGISTRY_EMAIL\"}}}" > ~/.docker/config.json
|
2021-11-25 17:50:57 +01:00
|
|
|
tags:
|
|
|
|
- "privileged"
|
|
|
|
|
|
|
|
build-docker-main:
|
|
|
|
<<: *docker
|
|
|
|
rules:
|
|
|
|
- if: '$CI_PROJECT_NAMESPACE != "framasoft"'
|
|
|
|
when: never
|
|
|
|
- if: '$CI_PIPELINE_SOURCE == "schedule"'
|
|
|
|
script:
|
2021-11-29 10:38:05 +01:00
|
|
|
- docker buildx build --push --platform linux/amd64 -t framasoft/mobilizon:main -f docker/production/Dockerfile .
|
2021-11-25 17:50:57 +01:00
|
|
|
|
|
|
|
build-docker-tag:
|
|
|
|
<<: *docker
|
|
|
|
rules: &tag-rules
|
|
|
|
- if: '$CI_PROJECT_NAMESPACE != "framasoft"'
|
|
|
|
when: never
|
|
|
|
- if: $CI_COMMIT_TAG
|
|
|
|
timeout: 3 hours
|
2020-11-09 10:04:55 +01:00
|
|
|
script:
|
2021-10-21 12:00:38 +02:00
|
|
|
- >
|
|
|
|
docker buildx build
|
|
|
|
--push
|
|
|
|
--platform linux/amd64,linux/arm64,linux/arm
|
2021-11-25 17:50:57 +01:00
|
|
|
-t framasoft/mobilizon:$CI_COMMIT_TAG
|
|
|
|
-t framasoft/mobilizon:latest
|
2021-10-21 12:00:38 +02:00
|
|
|
-f docker/production/Dockerfile .
|
2020-12-21 16:56:38 +01:00
|
|
|
|
2021-10-21 12:00:38 +02:00
|
|
|
# Packaging app for amd64
|
2020-12-23 00:01:25 +01:00
|
|
|
package-app:
|
2022-04-09 22:03:30 +02:00
|
|
|
image: mobilizon/buildpack:1.13.4-erlang-24.3.3-${OS}
|
2020-12-23 00:01:25 +01:00
|
|
|
stage: package
|
2022-04-08 10:40:35 +02:00
|
|
|
before_script:
|
|
|
|
- apt-get update && apt-get install -yq build-essential git curl cmake
|
2021-02-10 14:11:20 +01:00
|
|
|
variables: &release-variables
|
2020-12-21 16:56:38 +01:00
|
|
|
MIX_ENV: "prod"
|
2022-04-08 10:40:35 +02:00
|
|
|
DEBIAN_FRONTEND: noninteractive
|
|
|
|
TZ: Etc/UTC
|
|
|
|
APP_ASSET: "${CI_PROJECT_NAME}_${CI_COMMIT_REF_NAME}_${ARCH}_${OS}.tar.gz"
|
2021-02-10 14:11:20 +01:00
|
|
|
script: &release-script
|
2021-01-12 19:47:10 +01:00
|
|
|
- mix local.hex --force
|
|
|
|
- mix local.rebar --force
|
2021-11-10 16:37:24 +01:00
|
|
|
- mix deps.get --only-prod
|
|
|
|
- mix compile
|
|
|
|
- mix phx.digest.clean --all && \
|
2021-03-16 11:07:44 +01:00
|
|
|
- mix release --path release/mobilizon
|
2021-10-18 14:46:04 +02:00
|
|
|
- cd release/mobilizon && ln -s lib/mobilizon-*/priv priv && cd ../../
|
2021-10-18 14:16:48 +02:00
|
|
|
- du -sh release/
|
2021-10-18 14:46:04 +02:00
|
|
|
- 'echo "Artifact: ${APP_ASSET}"'
|
|
|
|
- tar czf ${APP_ASSET} -C release mobilizon
|
|
|
|
- du -sh ${APP_ASSET}
|
2021-02-10 14:11:20 +01:00
|
|
|
only:
|
|
|
|
- tags@framasoft/mobilizon
|
|
|
|
artifacts:
|
2021-12-13 17:59:54 +01:00
|
|
|
expire_in: 2 days
|
2021-02-10 14:11:20 +01:00
|
|
|
paths:
|
2021-10-18 16:05:45 +02:00
|
|
|
- ${APP_ASSET}
|
2022-04-08 10:40:35 +02:00
|
|
|
parallel:
|
|
|
|
matrix:
|
2022-04-09 17:46:48 +02:00
|
|
|
- OS: ["debian-bullseye", "debian-buster", "ubuntu-focal", "ubuntu-bionic", "fedora-35", "fedora-36", "alpine-3.14.5", "alpine-3.15.3"]
|
2021-02-10 14:11:20 +01:00
|
|
|
|
|
|
|
package-app-dev:
|
|
|
|
stage: package
|
|
|
|
variables: *release-variables
|
|
|
|
script: *release-script
|
|
|
|
except:
|
|
|
|
- tags@framasoft/mobilizon
|
2020-12-21 16:56:38 +01:00
|
|
|
artifacts:
|
2020-12-23 00:01:25 +01:00
|
|
|
expire_in: 2 days
|
2020-12-21 16:56:38 +01:00
|
|
|
paths:
|
2021-10-18 16:05:45 +02:00
|
|
|
- ${APP_ASSET}
|
2020-12-21 16:56:38 +01:00
|
|
|
|
2021-10-21 12:00:38 +02:00
|
|
|
# Packaging app for multi-arch
|
|
|
|
multi-arch-release:
|
|
|
|
stage: package
|
2022-03-31 10:51:45 +02:00
|
|
|
image: docker:20.10.12
|
2021-10-21 12:00:38 +02:00
|
|
|
variables:
|
|
|
|
DOCKER_TLS_CERTDIR: "/certs"
|
|
|
|
DOCKER_HOST: tcp://docker:2376
|
|
|
|
DOCKER_TLS_VERIFY: 1
|
|
|
|
DOCKER_CERT_PATH: "$DOCKER_TLS_CERTDIR/client"
|
|
|
|
DOCKER_DRIVER: overlay2
|
2022-04-08 10:40:35 +02:00
|
|
|
APP_ASSET: "${CI_PROJECT_NAME}_${CI_COMMIT_REF_NAME}_${ARCH}_${OS}.tar.gz"
|
|
|
|
# For now, arm and arm64 are only build for debian bullseye version
|
|
|
|
OS: debian-bullseye
|
2021-10-21 12:00:38 +02:00
|
|
|
services:
|
2022-03-31 10:51:45 +02:00
|
|
|
- docker:20.10.12-dind
|
2021-10-21 12:00:38 +02:00
|
|
|
cache: {}
|
|
|
|
before_script:
|
|
|
|
# Install buildx
|
2022-03-23 14:51:26 +01:00
|
|
|
- wget https://github.com/docker/buildx/releases/download/v0.8.1/buildx-v0.8.1.linux-amd64
|
2021-10-21 12:00:38 +02:00
|
|
|
- mkdir -p ~/.docker/cli-plugins/
|
2022-03-24 16:37:03 +01:00
|
|
|
- mv buildx-v0.8.1.linux-amd64 ~/.docker/cli-plugins/docker-buildx
|
2021-10-21 12:00:38 +02:00
|
|
|
- chmod a+x ~/.docker/cli-plugins/docker-buildx
|
|
|
|
# Create env
|
|
|
|
- docker context create tls-environment
|
|
|
|
- docker buildx create --use tls-environment
|
|
|
|
# Install qemu/binfmt
|
|
|
|
- docker pull tonistiigi/binfmt:latest
|
|
|
|
- docker run --rm --privileged tonistiigi/binfmt:latest --install all
|
|
|
|
script:
|
|
|
|
- docker buildx build --platform linux/${ARCH} --output type=local,dest=releases --build-arg APP_ASSET=${APP_ASSET} -f docker/multiarch/Dockerfile .
|
|
|
|
- ls -alh releases/mobilizon/
|
|
|
|
- du -sh releases/mobilizon/${APP_ASSET}
|
2021-11-15 13:37:00 +01:00
|
|
|
- mv releases/mobilizon/${APP_ASSET} .
|
2021-10-21 12:00:38 +02:00
|
|
|
tags:
|
|
|
|
- "privileged"
|
|
|
|
artifacts:
|
2021-12-13 17:59:54 +01:00
|
|
|
expire_in: 2 days
|
2021-10-21 12:00:38 +02:00
|
|
|
paths:
|
2021-11-15 13:37:00 +01:00
|
|
|
- ${APP_ASSET}
|
2021-10-21 12:00:38 +02:00
|
|
|
parallel:
|
|
|
|
matrix:
|
|
|
|
- ARCH: ["arm", "arm64"]
|
|
|
|
rules:
|
|
|
|
- if: '$CI_PROJECT_NAMESPACE != "framasoft"'
|
|
|
|
when: never
|
|
|
|
- if: '$CI_PIPELINE_SOURCE == "schedule"'
|
|
|
|
- if: $CI_COMMIT_TAG
|
2021-11-10 16:38:42 +01:00
|
|
|
timeout: 3h
|
2021-10-21 12:00:38 +02:00
|
|
|
|
|
|
|
# Release
|
2020-12-23 00:01:25 +01:00
|
|
|
release-upload:
|
|
|
|
stage: upload
|
2021-12-16 16:49:37 +01:00
|
|
|
image: framasoft/upload-packages:latest
|
2021-11-10 16:38:42 +01:00
|
|
|
variables:
|
|
|
|
APP_ASSET: "${CI_PROJECT_NAME}_${CI_COMMIT_REF_NAME}_${ARCH}.tar.gz"
|
2021-06-21 11:41:45 +02:00
|
|
|
rules: *tag-rules
|
2021-06-21 10:15:05 +02:00
|
|
|
script:
|
|
|
|
- eval `ssh-agent -s`
|
|
|
|
- ssh-add <(echo "${DEPLOYEMENT_KEY}" | base64 --decode -i)
|
2021-11-10 16:38:42 +01:00
|
|
|
- echo "put -r ${APP_ASSET}" | sftp -o "VerifyHostKeyDNS yes" ${DEPLOYEMENT_USER}@${DEPLOYEMENT_HOST}:public/
|
2020-12-21 16:56:38 +01:00
|
|
|
artifacts:
|
|
|
|
expire_in: 1 day
|
|
|
|
when: on_success
|
|
|
|
paths:
|
2021-01-13 09:05:39 +01:00
|
|
|
- mobilizon_*.tar.gz
|
2021-11-10 16:38:42 +01:00
|
|
|
parallel:
|
|
|
|
matrix:
|
|
|
|
- ARCH: ["amd64", "arm", "arm64"]
|
2021-01-27 11:43:12 +01:00
|
|
|
|
2021-06-21 10:15:05 +02:00
|
|
|
release-create:
|
|
|
|
stage: deploy
|
|
|
|
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
2021-06-21 11:41:45 +02:00
|
|
|
rules: *tag-rules
|
2021-11-12 17:20:27 +01:00
|
|
|
variables:
|
|
|
|
APP_ASSET_AMD64: "${CI_PROJECT_NAME}_${CI_COMMIT_REF_NAME}_amd64.tar.gz"
|
|
|
|
APP_ASSET_ARM: "${CI_PROJECT_NAME}_${CI_COMMIT_REF_NAME}_arm.tar.gz"
|
|
|
|
APP_ASSET_ARM64: "${CI_PROJECT_NAME}_${CI_COMMIT_REF_NAME}_arm64.tar.gz"
|
2021-06-21 10:15:05 +02:00
|
|
|
before_script:
|
2021-06-21 13:32:54 +02:00
|
|
|
- apk --no-cache add gawk sed grep
|
2021-06-21 10:15:05 +02:00
|
|
|
script: |
|
|
|
|
CHANGELOG=$(awk -v version="$APP_VERSION" '/^## / { printit = $2 == version }; printit' CHANGELOG.md | grep -v "## $APP_VERSION" | sed '1{/^$/d}')
|
|
|
|
ENDPOINT="https://packages.joinmobilizon.org"
|
|
|
|
|
2021-06-27 16:21:19 +02:00
|
|
|
release-cli create --name "$CI_COMMIT_TAG" \
|
2021-06-21 10:15:05 +02:00
|
|
|
--description "$CHANGELOG" \
|
|
|
|
--tag-name "$CI_COMMIT_TAG" \
|
2021-11-12 17:20:27 +01:00
|
|
|
--assets-link "{\"name\":\"${APP_ASSET_AMD64}\",\"url\":\"${ENDPOINT}/${APP_ASSET_AMD64}\"}" \
|
|
|
|
--assets-link "{\"name\":\"${APP_ASSET_ARM}\",\"url\":\"${ENDPOINT}/${APP_ASSET_ARM}\"}" \
|
|
|
|
--assets-link "{\"name\":\"${APP_ASSET_ARM64}\",\"url\":\"${ENDPOINT}/${APP_ASSET_ARM64}\"}"
|