diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..f51cd4f --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,39 @@ +stages: + - Build + - Release + +"Build": + stage: Build + image: node:alpine + rules: + - if: $CI_COMMIT_TAG + script: + - npm ci + - npm run build + - apk add --no-cache zip + - cd dist && zip -r ../naturvardarna-site.zip . && cd .. + artifacts: + paths: + - dist/ + - naturvardarna-site.zip + expire_in: 30 days + +"Create Release": + stage: Release + image: registry.gitlab.com/gitlab-org/release-cli:latest + needs: + - job: build_site + artifacts: true + rules: + - if: $CI_COMMIT_TAG + script: + - echo "Creating release for tag $CI_COMMIT_TAG" + release: + name: "Release $CI_COMMIT_TAG" + description: "Automated release of the Naturvärdarna static site." + tag_name: "$CI_COMMIT_TAG" + ref: "$CI_COMMIT_TAG" + assets: + links: + - name: "Compiled Site (ZIP)" + url: "${CI_PROJECT_URL}/-/jobs/artifacts/${CI_COMMIT_TAG}/raw/naturvardarna-site.zip?job=build_site"