]> git.mxchange.org Git - friendica-addons.git/blobdiff - .drone.yml
fromapp AR translations updated THX abidin toumi
[friendica-addons.git] / .drone.yml
index e26f987c6f1498081da95df2c2b9795a3298f1e1..b80d4344d993cdca3cdf4a67d312f74d88eaba63 100644 (file)
@@ -72,16 +72,121 @@ steps:
 ---
 kind: pipeline
 type: docker
-name: php-continous-package
+name: continuous-deployment
 
-#trigger:
-#  repo:
-#    - friendica/friendica-addons
-#  branch:
-#    - develop
-#    - 20*-rc
-#  event:
-#    - push
+trigger:
+  repo:
+    - friendica/friendica-addons
+  branch:
+    - develop
+    - 20*-rc
+  event:
+    - push
+
+node:
+  node: releaser # This prevents executing this pipeline at other servers than drone.friendi.ca
+
+clone:
+  disable: true
+
+steps:
+  - name: Clone friendica base
+    image: alpine/git
+    commands:
+      - git clone https://github.com/friendica/friendica.git .
+      - git checkout $DRONE_COMMIT_BRANCH
+  - name: Clone friendica addon
+    image: alpine/git
+    commands:
+      - git clone $DRONE_REPO_LINK addon
+      - cd addon/
+      - git checkout $DRONE_COMMIT_BRANCH
+      - git fetch origin $DRONE_COMMIT_REF
+      - git merge $DRONE_COMMIT_SHA
+  - name: Create artifacts
+    image: debian
+    commands:
+      - apt-get update
+      - apt-get install bzip2
+      - export VERSION="$(cat VERSION)"
+      - export RELEASE="friendica-addons-$VERSION"
+      - export ARTIFACT="$RELEASE.tar.gz"
+      - mkdir ./build
+      - # Create artifact for friendica-addons
+      - tar
+        --exclude='.tx'
+        --exclude='.git'
+        --exclude='.editorconfig'
+        --exclude='.gitattributes'
+        --exclude='.gitignore'
+        --exclude='.drone.yml'
+        --exclude='**/*/messages.po'
+        -cvzf ./build/$ARTIFACT addon/
+      - # calculate SHA256 checksum
+      - cd ./build
+      - sha256sum "$ARTIFACT" > "$ARTIFACT.sum256"
+      - chmod 664 ./*
+      - ls -lh
+      - # output the sha256 sum for checking
+      - cat "$ARTIFACT.sum256"
+      - sha256sum "$ARTIFACT"
+  - name: Sign artifacts
+    image: plugins/gpgsign
+    settings:
+      key:
+        from_secret: gpg_key
+      passphrase:
+        from_secret: gpg_password
+      files:
+        - build/*
+      exclude:
+        - build/*.sum256
+      detach_sign: true
+  - name: Upload artifacts
+    image: alpine
+    environment:
+      LFTP_HOST:
+        from_secret: sftp_host
+      LFTP_USER:
+        from_secret: sftp_user
+      LFTP_KEY:
+        from_secret: ssh_key
+      LFTP_PORT: "22"
+      LFTP_SOURCE: "build"
+      LFTP_TARGET: "/http"
+    commands:
+      - apk add lftp openssh openssl
+      - touch drone.key
+      - chmod 400 drone.key
+      - echo "$LFTP_KEY" | openssl base64 -A -d > drone.key
+      - lftp -c "
+        set net:timeout 5;
+        set net:max-retries 2;
+        set net:reconnect-interval-base 5;
+        set sftp:auto-confirm true;
+        set sftp:connect-program 'ssh -q -a -x -i drone.key';
+        connect sftp://$LFTP_USER:@$LFTP_HOST:$LFTP_PORT;
+        cd $LFTP_TARGET;
+        mput $LFTP_SOURCE/*;
+        "
+      - rm drone.key
+
+volumes:
+  - name: cache
+    host:
+      path: /tmp/drone-cache
+---
+kind: pipeline
+type: docker
+name: release-deployment
+
+trigger:
+  repo:
+    - friendica/friendica-addons
+  branch:
+    - stable
+  event:
+    - tag
 
 node:
   node: releaser # This prevents executing this pipeline at other servers than drone.friendi.ca
@@ -109,22 +214,39 @@ steps:
       - apt-get update
       - apt-get install bzip2
       - export VERSION="$(cat VERSION)"
-      - export RELEASEADDONS="friendica-addons-$VERSION"
-      - export ARTIFACTADDONS="$RELEASEADDON.tar.gz"
+      - export RELEASE="friendica-addons-$VERSION"
+      - export ARTIFACT="$RELEASE.tar.gz"
       - mkdir ./build
       - # Create artifact for friendica-addons
       - tar
-        --exclude='./.tx'
-        --exclude='./.git'
-        --exclude='./.editorconfig'
-        --exclude='./.gitattributes'
-        --exclude='./.gitignore'
-        --exclude='./.drone.yml'
-        --exclude='./**/*/messages.po'
-        -cvjf ./build/$ARTIFACTADDONS --transform "s,^addon,$RELEASEADDONS," addon/
+        --exclude='.tx'
+        --exclude='.git'
+        --exclude='.editorconfig'
+        --exclude='.gitattributes'
+        --exclude='.gitignore'
+        --exclude='.drone.yml'
+        --exclude='**/*/messages.po'
+        -cvzf ./build/$ARTIFACT addon/
       - # calculate SHA256 checksum
-      - sha256sum ./build/$ARTIFACTADDONS > ./build/$ARTIFACTADDONS.sha256
-      - ls -lh ./build
+      - cd ./build
+      - sha256sum "$ARTIFACT" > "$ARTIFACT.sum256"
+      - chmod 664 ./*
+      - ls -lh
+      - # output the sha256 sum for checking
+      - cat "$ARTIFACT.sum256"
+      - sha256sum "$ARTIFACT"
+  - name: Sign artifacts
+    image: plugins/gpgsign
+    settings:
+      key:
+        from_secret: gpg_key
+      passphrase:
+        from_secret: gpg_password
+      files:
+        - build/*
+      exclude:
+        - build/*.sum256
+      detach_sign: true
   - name: Upload artifacts
     image: alpine
     environment: