]> git.mxchange.org Git - friendica.git/commitdiff
Setup PHP release workflow in drone with lftp
authorPhilipp <admin@philipp.info>
Sun, 16 May 2021 19:53:55 +0000 (21:53 +0200)
committerPhilipp <admin@philipp.info>
Fri, 3 Sep 2021 07:36:51 +0000 (09:36 +0200)
.drone.yml
mods/release-list-exclude.txt [new file with mode: 0644]
mods/release-list-include.txt [new file with mode: 0644]
mods/release-list.txt [deleted file]

index b45409a846ef111c9abccf8be9d83705979b347d..18b84b76e15b1b2bf24c5be439d5abf478cd163f 100644 (file)
@@ -325,3 +325,200 @@ volumes:
   - name: cache
     host:
       path: /tmp/drone-cache
+---
+kind: pipeline
+type: docker
+name: continous-deployment
+
+trigger:
+  repo:
+    - friendica/friendica
+  branch:
+    - develop
+    - 20*-rc
+  event:
+    - push
+
+node:
+  node: releaser # This prevents executing this pipeline at other servers than drone.friendi.ca
+
+steps:
+  - name: Clone addon
+    image: alpine/git
+    commands:
+      - git clone https://github.com/friendica/friendica-addons ./addon
+      - cd ./addon
+      - git checkout $DRONE_REPO_BRANCH
+  - name: Restore cache
+    image: meltwater/drone-cache:dev
+    settings:
+      backend: "filesystem"
+      restore: true
+      cache_key: '{{ .Repo.Name }}_php74_{{ arch }}_{{ os }}'
+      archive_format: "gzip"
+      mount:
+        - '.composer'
+    volumes:
+      - name: cache
+        path:
+          /tmp/cache
+  - name: Composer install
+    image: friendicaci/php7.4:php7.4.18
+    commands:
+      - export COMPOSER_HOME=.composer
+      - composer validate
+      - composer install --no-dev --optimize-autoloader
+  - name: Create artifacts
+    image: debian
+    commands:
+      - apt-get update
+      - apt-get install bzip2
+      - mkdir ./build
+      - export VERSION="$(cat VERSION)"
+      - # Create artifact
+      - export RELEASE="friendica-full-$VERSION"
+      - export ARTIFACT="$RELEASE.tar.gz"
+      - tar
+        --transform "s,^,$RELEASE/,"
+        -X mods/release-list-exclude.txt
+        -T mods/release-list-include.txt
+        -cvjf ./build/$ARTIFACT
+      - # calculate SHA256 checksum
+      - cd ./build
+      - sha256sum "$ARTIFACT" > "$ARTIFACT.sha256"
+      - ls -lh
+      - # output the sha256 sum for checking
+      - cat "$ARTIFACT.sha256"
+      - sha256sum "$ARTIFACT"
+  - 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
+  branch:
+    - stable
+  event:
+    - tag
+
+node:
+  node: releaser # This prevents executing this pipeline at other servers than drone.friendi.ca
+
+steps:
+  - name: Clone addon
+    image: alpine/git
+    commands:
+      - git clone https://github.com/friendica/friendica-addons ./addon
+      - cd ./addon
+      - git checkout $DRONE_REPO_BRANCH
+  - name: Restore cache
+    image: meltwater/drone-cache:dev
+    settings:
+      backend: "filesystem"
+      restore: true
+      cache_key: '{{ .Repo.Name }}_php74_{{ arch }}_{{ os }}'
+      archive_format: "gzip"
+      mount:
+        - '.composer'
+    volumes:
+      - name: cache
+        path:
+          /tmp/cache
+  - name: Composer install
+    image: friendicaci/php7.4:php7.4.18
+    commands:
+      - export COMPOSER_HOME=.composer
+      - composer validate
+      - composer install --no-dev --optimize-autoloader
+  - name: Create artifacts
+    image: debian
+    commands:
+      - apt-get update
+      - apt-get install bzip2
+      - mkdir ./build
+      - export VERSION="$(cat VERSION)"
+      - mkdir ./build
+      - export VERSION="$(cat VERSION)"
+      - # Create artifact
+      - export RELEASE="friendica-full-$VERSION"
+      - export ARTIFACT="$RELEASE.tar.gz"
+      - tar
+        --transform "s,^,$RELEASE/,"
+        -X mods/release-list-exclude.txt
+        -T mods/release-list-include.txt
+        -cvjf ./build/$ARTIFACT
+      - # calculate SHA256 checksum
+      - cd ./build
+      - sha256sum "$ARTIFACT" > "$ARTIFACT.sha256"
+      - ls -lh
+      - # output the sha256 sum for checking
+      - cat "$ARTIFACT.sha256"
+      - sha256sum "$ARTIFACT"
+  - 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
diff --git a/mods/release-list-exclude.txt b/mods/release-list-exclude.txt
new file mode 100644 (file)
index 0000000..e370e73
--- /dev/null
@@ -0,0 +1,2 @@
+view/lang/*/messages.po
+view/smarty3/compiled/*
\ No newline at end of file
diff --git a/mods/release-list-include.txt b/mods/release-list-include.txt
new file mode 100644 (file)
index 0000000..95faa36
--- /dev/null
@@ -0,0 +1,30 @@
+bin/.htaccess
+bin/auth_ejabberd.php
+bin/console
+bin/console.bat
+bin/console.php
+bin/daemon.php
+bin/testargs.php
+bin/worker.php
+config/
+doc/
+images/
+include/
+mod/
+mods/
+spec/
+src/
+static/
+vendor/
+view/
+.htaccess-dist
+boot.php
+CHANGELOG
+CREDITS.txt
+database.sql
+index.php
+LICENSE
+README.md
+security.txt
+update.php
+VERSION
\ No newline at end of file
diff --git a/mods/release-list.txt b/mods/release-list.txt
deleted file mode 100644 (file)
index dfebc02..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-bin/auth_ejabberd.php
-bin/console
-bin/console.bat
-bin/console.php
-bin/daemon.php
-bin/testargs.php
-bin/worker.php
-config/
-doc/
-images/
-include/
-mod/
-mods/
-spec/
-src/
-static/
-vendor/
-view/
-.htaccess-dist
-boot.php
-CHANGELOG
-CREDITS.txt
-database.sql
-index.php
-LICENSE
-README.md
-security.txt
-update.php
-VERSION
\ No newline at end of file