Skip to content

v0.51.2

v0.51.2 #165

Workflow file for this run

name: Deploy Index
on:
release:
types: [published]
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get release tag
id: get_tag
run: |
if [ "${{ github.event_name }}" == "release" ]; then
echo "tag=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT
else
# For workflow_dispatch, get the latest release tag
echo "tag=$(gh release list --limit 1 --json tagName --jq '.[0].tagName')" >> $GITHUB_OUTPUT
fi
env:
GH_TOKEN: ${{ github.token }}
- name: Download release assets
run: |
mkdir -p ./artifacts/x86_64 ./artifacts/aarch64
gh release download ${{ steps.get_tag.outputs.tag }} \
--pattern "geode-index-${{ steps.get_tag.outputs.tag }}-linux-x86_64" \
--dir ./artifacts/x86_64
gh release download ${{ steps.get_tag.outputs.tag }} \
--pattern "geode-index-${{ steps.get_tag.outputs.tag }}-linux-aarch64" \
--dir ./artifacts/aarch64
chmod +x ./artifacts/x86_64/geode-index-${{ steps.get_tag.outputs.tag }}-linux-x86_64
chmod +x ./artifacts/aarch64/geode-index-${{ steps.get_tag.outputs.tag }}-linux-aarch64
env:
GH_TOKEN: ${{ github.token }}
- name: Create ssh key
run: |
install -m 600 -D /dev/null ~/.ssh/id_rsa
echo "${{ secrets.PRIVATE_KEY }}" > ~/.ssh/id_rsa
ssh-keyscan -p ${{ secrets.INDEX_SSH_PORT }} -H ${{ secrets.INDEX_SERVER }} > ~/.ssh/known_hosts
- name: Upload target to server
id: upload
run: |
rsync -avz -e "ssh -p ${{ secrets.INDEX_SSH_PORT }} -i ~/.ssh/id_rsa" --owner --group --chmod=775 --chown=${{ secrets.INDEX_RUN_USER }}:${{ secrets.INDEX_RUN_GROUP }} ./artifacts/${{ secrets.INDEX_DEPLOY_ARCH }}/geode-index-${{ steps.get_tag.outputs.tag }}-linux-${{ secrets.INDEX_DEPLOY_ARCH }} ${{ secrets.INDEX_USER }}@${{ secrets.INDEX_SERVER }}:${{ secrets.INDEX_COPY_LOCATION }}
rsync -avz -e "ssh -p ${{ secrets.INDEX_SSH_PORT }} -i ~/.ssh/id_rsa" --owner --group --chmod=775 --chown=${{ secrets.INDEX_RUN_USER }}:${{ secrets.INDEX_RUN_GROUP }} ./migrations/* ${{ secrets.INDEX_USER }}@${{ secrets.INDEX_SERVER }}:${{ secrets.MIGRATIONS_COPY_LOCATION }}
- name: Run update script
run: |
ssh -p ${{ secrets.INDEX_SSH_PORT }} ${{ secrets.INDEX_USER }}@${{ secrets.INDEX_SERVER }} "cd ${{ secrets.INDEX_UPDATE_SCRIPT_PATH }} && ./update.sh"
if: steps.upload.outcome == 'success'