ci: use before_script

Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
Matej Focko 2023-07-08 12:08:27 +02:00
parent 37db95b56d
commit bc8bce309e
Signed by: mfocko
GPG key ID: 7C47D46246790496

View file

@ -1,11 +1,28 @@
image: node:current-alpine3.15 default:
image: node:current-alpine3.15
cache: cache:
key: key:
files: files:
- yarn.lock - yarn.lock
paths: paths:
- .yarn-cache/ - .yarn-cache/
before_script:
# Handle the Yarn
- echo 'yarn-offline-mirror ".yarn-cache/"' >> .yarnrc
- echo 'yarn-offline-mirror-pruning true' >> .yarnrc
- yarn install --frozen-lockfile --no-progress
# Install the dependencies for alpine
- apk update && apk add make graphviz zip openssh rsync
# Prepare environment for SSH
- mkdir -p ~/.ssh
- ln -s $SSH_CONFIG ~/.ssh/config
- ln -s $SSH_KEY ~/.ssh/id_ed25519
- ln -s $SSH_KNOWN_HOSTS ~/.ssh/known_hosts
- chmod 600 ~/.ssh/config ~/.ssh/id_ed25519 ~/.ssh/known_hosts
stages: stages:
- build - build
@ -15,57 +32,39 @@ build:
stage: build stage: build
script: script:
# Handle the Yarn # Regenerate the static files
- echo 'yarn-offline-mirror ".yarn-cache/"' >> .yarnrc - make regenerate-dots
- echo 'yarn-offline-mirror-pruning true' >> .yarnrc - make regenerate-zips
- yarn install --frozen-lockfile --no-progress
# Install the dependencies for alpine # Run a mock build to enable faster rebuild
- apk update && apk add make graphviz zip openssh rsync - URL=http://localhost BASE_URL=/ yarn run build
# Regenerate the static files
- make regenerate-dots
- make regenerate-zips
# Run a mock build to enable faster rebuild
- URL=http://localhost BASE_URL=/ yarn run build
artifacts: artifacts:
paths: paths:
- "build/" - "build/"
deploy 1/2: deploy 1/2:
stage: deploy stage: deploy
script: script:
- mkdir -p ~/.ssh - make deploy-poincare
- ln -s $SSH_CONFIG ~/.ssh/config
- ln -s $SSH_KEY ~/.ssh/id_ed25519
- ln -s $SSH_KNOWN_HOSTS ~/.ssh/known_hosts
- chmod 600 ~/.ssh/config ~/.ssh/id_ed25519 ~/.ssh/known_hosts
- make deploy-poincare
artifacts: artifacts:
paths: paths:
- "build/" - "build/"
only: only:
- main - main
deploy 2/2: deploy 2/2:
stage: deploy stage: deploy
script: script:
- mkdir -p ~/.ssh - make deploy-aisa
- ln -s $SSH_CONFIG ~/.ssh/config
- ln -s $SSH_KEY ~/.ssh/id_ed25519
- ln -s $SSH_KNOWN_HOSTS ~/.ssh/known_hosts
- chmod 600 ~/.ssh/config ~/.ssh/id_ed25519 ~/.ssh/known_hosts
- make deploy-aisa
artifacts: artifacts:
paths: paths:
- "build/" - "build/"
only: only:
- main - main