mirror of
https://framagit.org/framasoft/mobilizon.git
synced 2024-12-22 07:52:43 +00:00
Release Elixir and frontend assets as part of the release
This commit is contained in:
parent
89258bb41e
commit
4dff52bbe0
2 changed files with 80 additions and 1 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -14,6 +14,7 @@ erl_crash.dump
|
|||
# secrets files as long as you replace their contents by environment
|
||||
# variables.
|
||||
/config/*.secret.exs
|
||||
/config/releases.exs
|
||||
|
||||
/setup_db.psql
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ stages:
|
|||
- test
|
||||
- deploy
|
||||
- docker
|
||||
- release
|
||||
|
||||
variables:
|
||||
MIX_ENV: "test"
|
||||
|
@ -20,6 +21,11 @@ variables:
|
|||
MOBILIZON_DATABASE_HOST: $POSTGRES_HOST
|
||||
GEOLITE_CITIES_PATH: "/usr/share/GeoIP/GeoLite2-City.mmdb"
|
||||
MOBILIZON_INSTANCE_REGISTRATIONS_OPEN: "true"
|
||||
# Release elements
|
||||
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${PACKAGE_VERSION}"
|
||||
ELIXIR_ASSET: "${CI_PROJECT_NAME}-standalone-${CI_COMMIT_TAG}.tar.gz"
|
||||
FRONTEND_ASSET: "${CI_PROJECT_NAME}-frontend-${CI_COMMIT_TAG}.tar.gz"
|
||||
|
||||
|
||||
cache:
|
||||
key: ${CI_COMMIT_REF_SLUG}
|
||||
|
@ -81,7 +87,8 @@ exunit:
|
|||
- mix deps.get
|
||||
- MIX_ENV=test mix ecto.create
|
||||
- MIX_ENV=test mix ecto.migrate
|
||||
dependencies:
|
||||
needs:
|
||||
- deps
|
||||
- lint-elixir
|
||||
script:
|
||||
- mix coveralls
|
||||
|
@ -170,3 +177,74 @@ build-docker-tag:
|
|||
- tags
|
||||
variables:
|
||||
DOCKER_IMAGE_NAME: framasoft/mobilizon:$CI_COMMIT_TAG
|
||||
|
||||
build-release-frontend:
|
||||
stage: release
|
||||
image: node:14-alpine
|
||||
before_script:
|
||||
- apk add --no-cache python build-base libwebp-tools bash imagemagick ncurses
|
||||
script:
|
||||
- yarn --cwd "js" install
|
||||
- yarn --cwd "js" run build
|
||||
artifacts:
|
||||
expire_in: 1 day
|
||||
paths:
|
||||
- priv/static
|
||||
|
||||
|
||||
build-release-elixir:
|
||||
stage: release
|
||||
image: elixir:alpine
|
||||
before_script:
|
||||
- apk add --no-cache build-base git cmake
|
||||
variables:
|
||||
MIX_ENV: "prod"
|
||||
script:
|
||||
- mix local.hex --force
|
||||
- mix local.rebar --force
|
||||
- mix deps.get
|
||||
- cp docker/production/releases.exs ./config/
|
||||
- mix phx.digest
|
||||
- mix release
|
||||
needs:
|
||||
- build-release-frontend
|
||||
artifacts:
|
||||
expire_in: 1 day
|
||||
paths:
|
||||
- _build/prod/rel
|
||||
|
||||
build-release-upload:
|
||||
stage: release
|
||||
image: curlimages/curl:latest
|
||||
# rules:
|
||||
# - if: $CI_COMMIT_TAG
|
||||
script: |
|
||||
ls -R _build
|
||||
tar czf /tmp/${ELIXIR_ASSET} -C _build/prod/rel mobilizon
|
||||
tar czf /tmp/${FRONTEND_ASSET} -C priv/static .
|
||||
ls -al /tmp/*.tar.gz
|
||||
|
||||
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file "_build/${ELIXIR_ASSET}" ${PACKAGE_REGISTRY_URL}/${ELIXIR_ASSET}
|
||||
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file "_build/${FRONTEND_ASSET}" ${PACKAGE_REGISTRY_URL}/${FRONTEND_ASSET}
|
||||
artifacts:
|
||||
expire_in: 1 day
|
||||
when: on_success
|
||||
paths:
|
||||
- _build/${ELIXIR_ASSET}
|
||||
- _build/${FRONTEND_ASSET}
|
||||
needs:
|
||||
- build-release-elixir
|
||||
|
||||
build-release-create:
|
||||
stage: release
|
||||
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
||||
rules:
|
||||
- if: $CI_COMMIT_TAG
|
||||
script: |
|
||||
release-cli create --name "Release $CI_COMMIT_SHA" \
|
||||
--tag-name "$CI_COMMIT_TAG" \
|
||||
--assets-link "{\"name\":\"${ELIXIR_ASSET}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${ELIXIR_ASSET}\"}" \
|
||||
--assets-link "{\"name\":\"${FRONTEND_ASSET}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${FRONTEND_ASSET}\"}"
|
||||
needs:
|
||||
- build-release-upload
|
||||
|
||||
|
|
Loading…
Reference in a new issue