[#317] Added Drone step to sync the stable branch on tag.

Closes: #317
This commit is contained in:
Fabio Manganiello 2023-10-01 23:17:53 +02:00
parent 3086dd86fc
commit 98b51362e9
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -37,6 +37,63 @@ steps:
- git pull --rebase github "$(git branch | head -1 | awk '{print $2}')" || echo "No such branch on Github" - git pull --rebase github "$(git branch | head -1 | awk '{print $2}')" || echo "No such branch on Github"
- git push --all -v github - git push --all -v github
###
### Synchronize the `stable` branch to the new release
###
- name: sync-stable-branch
image: alpine
environment:
SSH_PUBKEY:
from_secret: ssh_pubkey
SSH_PRIVKEY:
from_secret: ssh_privkey
PGP_KEY:
from_secret: pgp_key
PGP_KEY_ID:
from_secret: pgp_key_id
commands:
- apk add --update --no-cache git bash gnupg openssh
# Backup the original git configuration before changing attributes
- export GIT_CONF=$PWD/.git/config
- cp $GIT_CONF /tmp/git.config.orig
- git config --global --add safe.directory $PWD
# Install the SSH and PGP keys
- mkdir -p ~/.ssh
- |
cat <<EOF | gpg --import --armor
$PGP_KEY
EOF
- echo $SSH_PUBKEY > ~/.ssh/id_rsa.pub
- |
cat <<EOF > ~/.ssh/id_rsa
$SSH_PRIVKEY
EOF
- chmod 0600 ~/.ssh/id_rsa
- ssh-keyscan git.platypush.tech >> ~/.ssh/known_hosts 2>/dev/null
# Git configuration
- git config user.name "Platypush CI/CD Automation"
- git config user.email "admin@platypush.tech"
- git config commit.gpgsign true
- git config user.signingkey $PGP_KEY_ID
- git remote rm origin
- git remote add origin git@git.platypush.tech:platypush/platypush.git
# Push to the `stable` branch
- git push -u origin stable
# Restore the original git configuration
- mv /tmp/git.config.orig $GIT_CONF
when:
event:
- tag
### ###
### Rebuild the docs ### Rebuild the docs
### ###
@ -71,6 +128,9 @@ steps:
event: event:
- tag - tag
depends_on:
- sync-stable-branch
### ###
### Run the tests ### Run the tests
### ###