]> Repos - mime-chat/commitdiff
cicd
authorAndrew Gundersen <gundersena@xavier.edu>
Wed, 14 Apr 2021 18:22:53 +0000 (13:22 -0500)
committerAndrew Gundersen <gundersena@xavier.edu>
Wed, 14 Apr 2021 18:22:53 +0000 (13:22 -0500)
.gitlab-ci.yml [new file with mode: 0644]
package.json

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644 (file)
index 0000000..0043baf
--- /dev/null
@@ -0,0 +1,60 @@
+stages:
+  - Build
+  - Upload
+  - Release
+
+build:
+  stage: Build
+  image: osx_11
+  before_script:
+    - yarn
+  script:
+    - export VERSION=$(node -e "console.log(require('./package.json').version)")
+    - echo "VERSION=$VERSION" >> variables.env
+    - export APPNAME=$(node -e "console.log(require('./package.json').productName)")
+    - echo "APPNAME=$APPNAME" >> variables.env
+    - yarn electron:build
+  artifacts:
+    reports:
+      dotenv: variables.env
+    name: $CI_COMMIT_REF_SLUG
+    paths:
+      - $CI_PROJECT_DIR/dist_electron/*.*
+    when: on_success
+  only:
+    - main
+
+variables:
+  PACKAGE: '${APPNAME}-${VERSION}.dmg'
+  PACKAGE_REGISTRY_URL: '${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${APPNAME}/${VERSION}'
+
+upload:
+  stage: Upload
+  needs:
+    - job: build
+      artifacts: true
+  rules:
+    - if: $CI_COMMIT_TAG
+      when: never # Do not run this job when a tag is created manually
+    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Run this job when when commits are pushed to the default branch
+  script:
+    - 'curl --header "JOB-TOKEN: $CI_DEPLOY_PASSWORD" --upload-file "./dist_electron/${PACKAGE}" "${PACKAGE_REGISTRY_URL}/${PACKAGE}"'
+
+auto-release-master:
+  image: registry.gitlab.com/gitlab-org/release-cli
+  needs:
+    - job: build
+      artifacts: true
+    - job: upload
+      artifacts: true
+  stage: Release
+  rules:
+    - if: $CI_COMMIT_TAG
+      when: never # Do not run this job when a tag is created manually
+    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Run this job when when commits are pushed to the default branch
+  script:
+    - echo "Release $VERSION"
+    - |
+      release-cli create --name "Release $VERSION" --tag-name v$VERSION \
+      --description 'Created using the release-cli. $CI_COMMIT_TITLE' --ref $CI_COMMIT_SHA \
+      --assets-link "{\"name\":\"${APPNAME}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${PACKAGE}\"}"
index 743457c93d5b32b659a610486eef033c58a7ef0c..667bf64cce2cd30ec2f6f51494ab6a034d21bce4 100644 (file)
     "pluginOptions": {
       "electronBuilder": {
         "preload": "src/preload.ts",
-        "builderOptions": {
-          "appId": "com.crimata.${name}",
-          "productName": "Crimata Messenger",
-        }
       }
     }
   },
@@ -86,7 +82,7 @@
       "git add"
     ]
   },
-  "productName": "Crimata Messenger",
+  "productName": "crimata-messenger",
   "repository": {
     "type": "git",
     "url": "https://gitlab.com/crimata/electron-app.git",