Move snapshot releases to GitHub (#1767)
This commit is contained in:
parent
b8756a667c
commit
208e49e4d5
2 changed files with 50 additions and 14 deletions
8
.github/workflows/deploy_snapshot.yml
vendored
8
.github/workflows/deploy_snapshot.yml
vendored
|
@ -11,6 +11,8 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3.0.0
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v3.0.0
|
||||
|
@ -40,9 +42,3 @@ jobs:
|
|||
|
||||
- name: Deploy snapshot
|
||||
run: scripts/deploy-snapshot.sh
|
||||
env:
|
||||
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
|
||||
SSH_USERNAME: ${{ secrets.SSH_USERNAME }}
|
||||
SERVER_ADDRESS: ${{ secrets.SERVER_ADDRESS }}
|
||||
SERVER_DESTINATION: ${{ secrets.SERVER_DESTINATION }}
|
||||
SSH_PORT: ${{ secrets.SSH_PORT }}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env sh
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved.
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
|
@ -6,10 +6,50 @@
|
|||
|
||||
set -ex
|
||||
|
||||
export SSHDIR="$HOME/.ssh"
|
||||
mkdir -p "$SSHDIR"
|
||||
echo "$ACTIONS_DEPLOY_KEY" > "$SSHDIR/key"
|
||||
chmod 600 "$SSHDIR/key"
|
||||
export SERVER_DEPLOY_STRING="$SSH_USERNAME@$SERVER_ADDRESS:$SERVER_DESTINATION"
|
||||
cd "$GITHUB_WORKSPACE/app/outputs/"
|
||||
rsync -ahvcr --omit-dir-times --progress --delete --no-o --no-g -e "ssh -i $SSHDIR/key -o StrictHostKeyChecking=no -p $SSH_PORT" . "$SERVER_DEPLOY_STRING"
|
||||
LATEST_TAG="latest"
|
||||
CURRENT_REV="$(git rev-parse --short HEAD)"
|
||||
ASSET_DIRECTORY="${GITHUB_WORKSPACE}/app/outputs"
|
||||
|
||||
function overwrite_local_tag() {
|
||||
git tag -f "${LATEST_TAG}"
|
||||
}
|
||||
|
||||
function overwrite_remote_tag() {
|
||||
git push -f origin "${LATEST_TAG}"
|
||||
}
|
||||
|
||||
function has_release() {
|
||||
gh release view "${LATEST_TAG}"
|
||||
echo "$?"
|
||||
}
|
||||
|
||||
function delete_release() {
|
||||
gh release delete --yes "${LATEST_TAG}"
|
||||
}
|
||||
|
||||
function create_rev_file() {
|
||||
pushd "${ASSET_DIRECTORY}"
|
||||
echo "${CURRENT_REV}" | tee rev-hash.txt
|
||||
popd
|
||||
}
|
||||
|
||||
function create_release() {
|
||||
local CHANGELOG_FILE
|
||||
CHANGELOG_FILE="$(mktemp)"
|
||||
echo "Latest release for APS from revision ${CURRENT_REV}" | tee "${CHANGELOG_FILE}"
|
||||
pushd "${ASSET_DIRECTORY}"
|
||||
gh release create --title "Latest snapshot build" -F "${CHANGELOG_FILE}" "${LATEST_TAG}" ./*
|
||||
popd
|
||||
}
|
||||
|
||||
overwrite_local_tag
|
||||
|
||||
if [[ "$(has_release)" -eq 0 ]]; then
|
||||
delete_release
|
||||
fi
|
||||
|
||||
create_rev_file
|
||||
|
||||
overwrite_remote_tag
|
||||
|
||||
create_release
|
||||
|
|
Loading…
Reference in a new issue