From ed088387600c770739ad6b4bf461a13d3d65feb2 Mon Sep 17 00:00:00 2001 From: Aran Roig Date: Mon, 13 Jul 2026 17:24:15 +0200 Subject: [PATCH] First test --- .gitea/workflows/deploy.yml | 77 +++++++++++++++++++++++++++++++++++++ .obsidian/workspace.json | 12 ++++-- Bienvenido.md | 5 --- content/Exemple.md | 1 + content/index.md | 3 ++ 5 files changed, 89 insertions(+), 9 deletions(-) create mode 100644 .gitea/workflows/deploy.yml delete mode 100644 Bienvenido.md create mode 100644 content/Exemple.md create mode 100644 content/index.md diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..0c1d987 --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,77 @@ +name: Deploy Vault + +on: + push: + branches: + - master + +jobs: + deploy: + runs-on: docker + + env: + # URL of the repository to clone + TEMPLATE_REPO_URL: https://git.aranroig.com/Syndria98/dnd-vault-template.git + # Folder name inside the target repo where this repo's contents will be placed + TARGET_SUBFOLDER: template/content + VAULT_NAME: test-campaign + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + path: current + + - name: Install SSH client + run: | + apt-get update -y && apt-get install -y openssh-client + + - name: Setup SSH inside container + run: | + mkdir -p ~/.ssh + echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/id_ed25519 + chmod 600 ~/.ssh/id_ed25519 + + # Add the container host to known_hosts + ssh-keyscan -H ${{ secrets.DEPLOY_HOST }} >> ~/.ssh/known_hosts + + - name: Log in to registry + run: | + echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login git.aranroig.com -u "${{ secrets.REGISTRY_USER }}" --password-stdin + + - name: Clone target repository + run: | + git clone "$TEMPLATE_REPO_URL" target + + - name: Copy current repo contents into target subfolder + run: | + rm -R target/$TARGET_SUBFOLDER + mkdir -p target/$TARGET_SUBFOLDER + # Exclude the .git directory from the copy + rsync -av --exclude={.git,.obsidian,.gitea} current/content/ target/$TARGET_SUBFOLDER/ + + - name: Build frontend + run: | + docker build -t git.aranroig.com/${{ secrets.REGISTRY_USER }}/vault-$VAULT_NAME:latest ./target/template + docker push git.aranroig.com/${{ secrets.REGISTRY_USER }}/vault-$VAULT_NAME:latest + + - name: Generate docker compose .env + run: | + cat > ./target/.env << EOF + VAULT_NAME=$VAULT_NAME + EOF + + - name: Copy files + run: | + scp ./target/docker-compose.yml deploy@${{ secrets.DEPLOY_HOST}}:/var/www/app/ + scp ./target/nginx.conf deploy@${{ secrets.DEPLOY_HOST }}:/var/www/app/nginx.conf + scp ./target/.env deploy@${{ secrets.DEPLOY_HOST }}:/var/www/app/.env + + - name: Deploy + run: | + ssh deploy@${{ secrets.DEPLOY_HOST }} << 'EOF' + echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login git.aranroig.com -u "${{ secrets.REGISTRY_USER }}" --password-stdin + cd /var/www/app/ + docker-compose pull + docker-compose up -d + EOF diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index 3a0a84f..83a70c9 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -13,12 +13,12 @@ "state": { "type": "markdown", "state": { - "file": "Bienvenido.md", + "file": "content/Exemple.md", "mode": "preview", "source": false }, "icon": "lucide-file", - "title": "Bienvenido" + "title": "Exemple" } } ] @@ -180,11 +180,15 @@ "daily-notes:Abrir la nota de hoy": false, "templates:Insertar plantilla": false, "command-palette:Abrir paleta de comandos": false, - "bases:Crear nueva base": false + "bases:Crear nueva base": false, + "obsidian-git:Open Git source control": false } }, "active": "9f5d2c22ee960ac1", "lastOpenFiles": [ - "Bienvenido.md" + "content/index.md", + "content/Exemple.md", + "content/Bienvenido.md", + "content" ] } \ No newline at end of file diff --git a/Bienvenido.md b/Bienvenido.md deleted file mode 100644 index 84c86ff..0000000 --- a/Bienvenido.md +++ /dev/null @@ -1,5 +0,0 @@ -Esta es su nueva *bóveda*. - -Cree una nota de algo, [[cree un enlace]], o pruebe [el Importador](https://help.obsidian.md/Plugins/Importer)! - -Cuando esté listo, borre esta nota y aprópiese de la bóveda \ No newline at end of file diff --git a/content/Exemple.md b/content/Exemple.md new file mode 100644 index 0000000..b33ab90 --- /dev/null +++ b/content/Exemple.md @@ -0,0 +1 @@ +Test example test \ No newline at end of file diff --git a/content/index.md b/content/index.md new file mode 100644 index 0000000..4c3aa27 --- /dev/null +++ b/content/index.md @@ -0,0 +1,3 @@ +# Index + +Pagina principal. S'hauria de poder anara a [[Exemple]] \ No newline at end of file