Compare commits

..

2 Commits

Author SHA1 Message Date
cf9a2882d3 fix: deploying actions must be implemented by user 2024-11-24 21:27:51 -03:00
5a8c4c1b1a add: allow informing user and group id or name
Some checks failed
Caprover: Build & Deploy (backup-databases) / build (push) Failing after 7s
2024-11-24 21:21:53 -03:00
3 changed files with 17 additions and 58 deletions

View File

@@ -1,45 +0,0 @@
name: "Caprover: Build & Deploy (backup-databases)"
on:
push:
branches: [ "main", "dev" ]
pull_request:
branches: [ "main", "dev" ]
#env:
# API_URL: ${{ github.ref_name == 'main' && vars.API_URL && vars.API_URL || vars.DEV_API_URL }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Switch to branch ${{ github.ref_name }}
uses: actions/checkout@v4
- name: Pack app contents
run: |
tar -czv \
-f deploy.tar \
./captain-definition \
./Dockerfile \
./scripts
- name: Deploy webapp to development
if: github.ref_name == 'dev'
uses: caprover/deploy-from-github@v1.0.1
with:
server: "${{ vars.DEV_CAPROVER_SERVER || vars.CAPROVER_SERVER }}"
app: "${{ vars.DEV_APP_NAME || vars.APP_NAME }}"
token: "${{ secrets.DEV_APP_TOKEN }}"
- name: Deploy webapp to production
if: github.ref_name == 'main'
uses: caprover/deploy-from-github@v1.0.1
with:
server: "${{ vars.CAPROVER_SERVER }}"
app: "${{ vars.APP_NAME }}"
token: "${{ secrets.APP_TOKEN }}"

View File

@@ -3,7 +3,7 @@
#
# Connect to a Cloudflare's R2 storage using mochoa/s3fs
#
# Run this script on the Docker HOST to bind buckets using "linode-bucket"
# Run this script on the Docker HOST to bind buckets using "cloudflare-r2"
# -- Or any alias you give with "--alias" option -- driver name.
# Please refer to https://hub.docker.com/r/mochoa/s3fs-volume-plugin.
# You may bind to different buckets using different aliases.
@@ -30,16 +30,18 @@ while test $# -ne 0; do
elif test "${key}" = "-a" || test "${key}" = "--alias"; then
PLUGIN_ALIAS="${value}";
elif test "${key}" = "-u" || test "${key}" = "--user"; then
if id "${value}" > /dev/null 2>&1; then
USER_ID="$(id -u "${value}")";
else
passwdEntry=$(getent passwd ${value} || echo ":NOT_FOUND:");
if test "${passwdEntry}" = ":NOT_FOUND:"; then
USER_ID="$(id -u)";
else
USER_ID=$(echo $passwdEntry | cut -d ':' -f 3);
fi
elif test "${key}" = "-g" || test "${key}" = "--group"; then
if id "${value}" > /dev/null 2>&1; then
GROUP_ID="$(id -g "${value}")";
else
groupEntry=$(getent group ${value} || echo ":NOT_FOUND:");
if test "${groupEntry}" = ":NOT_FOUND:"; then
GROUP_ID="$(id -g)";
else
GROUP_ID=$(echo $groupEntry | cut -d ':' -f 3);
fi
else
echo "Invalid \"${key}\" option";

View File

@@ -28,16 +28,18 @@ while test $# -ne 0; do
elif test "${key}" = "-a" || test "${key}" = "--alias"; then
PLUGIN_ALIAS="${value}";
elif test "${key}" = "-u" || test "${key}" = "--user"; then
if id "${value}" > /dev/null 2>&1; then
USER_ID="$(id -u "${value}")";
else
passwdEntry=$(getent passwd ${value} || echo ":NOT_FOUND:");
if test "${passwdEntry}" = ":NOT_FOUND:"; then
USER_ID="$(id -u)";
else
USER_ID=$(echo $passwdEntry | cut -d ':' -f 3);
fi
elif test "${key}" = "-g" || test "${key}" = "--group"; then
if id "${value}" > /dev/null 2>&1; then
GROUP_ID="$(id -g "${value}")";
else
groupEntry=$(getent group ${value} || echo ":NOT_FOUND:");
if test "${groupEntry}" = ":NOT_FOUND:"; then
GROUP_ID="$(id -g)";
else
GROUP_ID=$(echo $groupEntry | cut -d ':' -f 3);
fi
else
echo "Invalid \"${key}\" option";