Skip to content

Commit

Permalink
Merge pull request #333 from steilerDev/beta
Browse files Browse the repository at this point in the history
stage for production release
  • Loading branch information
Frank Steiler authored Sep 18, 2023
2 parents f895d9a + afc42df commit 43a728c
Show file tree
Hide file tree
Showing 205 changed files with 31,704 additions and 15,133 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: steilerDev
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Feature Request
description: Suggest an idea for this project
labels: ["class(feature)", "status(open)"]
body:
- type: textarea
id: ultimate-goal
attributes:
label: Describe the ultimate goal you want to achieve
description: Describe the use case and motivation for this request.
validations:
required: true
- type: textarea
id: proposal
attributes:
label: How do you think the feature should be implemented
description: Describe the user facing and/or technical implementation approaches (if applicable).
- type: checkboxes
id: terms
attributes:
label: Checklist
description: Before submitting this issue, make sure you completed the following steps
options:
- label: This is a [feature request](https://github.com/steilerDev/icloud-photos-sync/blob/main/CONTRIBUTING.md#feature), not an [issue](https://github.com/steilerDev/icloud-photos-sync/blob/main/CONTRIBUTING.md#issue) or [a question](https://github.com/steilerDev/icloud-photos-sync/blob/main/CONTRIBUTING.md#question)
required: true
- label: Checked out [existing feature requests](https://github.com/steilerDev/icloud-photos-sync/issues?q=is%3Aopen+is%3Aissue+label%3Aclass%28feature%29+label%3Astatus%28open%29%2Cstatus%28wontfix%29%2Cstatus%28backlog%29%2C%22status%28help+needed%29%22%2C%22status%28in+progress%29%22%2Cstatus%28investigating%29%2Cstatus%28previewed%29+)
required: true
38 changes: 0 additions & 38 deletions .github/ISSUE_TEMPLATE/issue-template.md

This file was deleted.

69 changes: 69 additions & 0 deletions .github/ISSUE_TEMPLATE/issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Bug Report
description: Create a report to help us improve
labels: ["class(bug)", "status(open)"]
body:
- type: textarea
id: describe-issue
attributes:
label: Describe the issue
description: A clear and concise description of what the issue is.
validations:
required: true
- type: textarea
id: reproduction
attributes:
label: How to reproduce the behavior?
description: Steps how to reproduce the bug you are experiencing, also consider the properties of your iCloud Photo Library (e.g. size, age).
validations:
required: false
- type: input
id: error-code
attributes:
label: Error Code
description: Provide the error code, generated upon crash
placeholder: ex. 01234567-89ab-cdef-0123-456789abcdef
validations:
required: true
- type: textarea
id: logs
attributes:
label: Relevant log output
description: 'Please copy and paste any relevant log output (with `LOG_LEVEL=debug`), located in `.icloud-photos-sync.log`, stored in the user specified `DATA_DIR`'
render: shell-script
validations:
required: true
- type: input
id: os
attributes:
label: Operating system
placeholder: ex. Debian 10
validations:
required: true
- type: input
id: environment
attributes:
label: Execution environment
placeholder: ex. docker
validations:
required: true
- type: input
id: version
attributes:
label: icloud-photos-sync version
placeholder: ex. 1.0.1-beta.1
validations:
required: true
- type: checkboxes
id: terms
attributes:
label: Checklist
description: Before submitting this issue, make sure you completed the following steps
options:
- label: This is an [issue](https://github.com/steilerDev/icloud-photos-sync/blob/beta/CONTRIBUTING.md#-found-a-bug) and not [a question](https://github.com/steilerDev/icloud-photos-sync/blob/main/CONTRIBUTING.md#question) or [feature request](https://github.com/steilerDev/icloud-photos-sync/blob/main/CONTRIBUTING.md#feature)
required: true
- label: The sync was performed a couple of times and the issue is persisting and consistent
required: true
- label: Checked out [open and known issues](https://github.com/steilerDev/icloud-photos-sync/issues?q=is%3Aopen+is%3Aissue+label%3Aclass%28bug%29%2Cclass%28improvement%29%2C%22class%28known+issue%29%22)
required: true
- label: Enabled [crash and error reporting](https://steilerdev.github.io/icloud-photos-sync/user-guides/error-reporting/)
required: true
42 changes: 42 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
## PR Checklist
Please check if your PR fulfills the following requirements:

- [ ] The commit message follows our guidelines: https://github.com/steilerDev/icloud-photos-sync/blob/main/CONTRIBUTING.md#commit
- [ ] Tests for the changes have been added (for bug fixes / features)
- [ ] Docs have been added / updated (for bug fixes / features)


## PR Type
What kind of change does this PR introduce?

<!-- Please check the one that applies to this PR using "x". -->

- [ ] Bugfix
- [ ] Feature
- [ ] Code style update (formatting, local variables)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] CI related changes
- [ ] Documentation content changes
- [ ] Other... Please describe:


## What is the current behavior?
<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->

Issue Number: N/A


## What is the new behavior?


## Does this PR introduce a breaking change?

- [ ] Yes
- [ ] No


<!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. -->


## Other information
94 changes: 94 additions & 0 deletions .github/acquire-trust-token.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#!/bin/bash

# This helper script initiates the trust token acquisition by triggering the necessary workflow and opening a tunnel through wireguard
WORKFLOW_NAME='action_trust-token.yml --ref dev'

# Settings for mapping the ICPS directory into the container
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
SRC_DIR=$(dirname $SCRIPT_DIR)
ICPS_DOCKER_DIR="/icloud-photos-sync"
ICPS_DOCKER_SCRIPT_DIR="$ICPS_DOCKER_DIR/docker/rootfs/root/"
ICPS_RESEND_MFA_SCRIPT="$ICPS_DOCKER_SCRIPT_DIR/resend_mfa.sh"
ICPS_ENTER_MFA_SCRIPT="$ICPS_DOCKER_SCRIPT_DIR/enter_mfa.sh"

# Settings for requesting the MFA Code
ICPS_PORT=8080
MFA_METHOD="sms"
MFA_ID="2"

if ! which gh > /dev/null; then
echo "Please make sure the GH cli is installed"
fi

function stop_container() {
if [ ! -z $DOCKER_NAME ]; then
echo
echo -n "Stopping container $DOCKER_NAME..."
docker stop $DOCKER_NAME > /dev/null
docker rm -v $DOCKER_NAME > /dev/null
echo "done"
else
echo "Not stopping container, because name is not available"
fi
}
trap stop_container exit

# Start Wireguard Tunnel
echo -n "Starting wireguard tunnel"
WG_SERVER_PORT=56789
WG_SUBNET="192.168.1.0"
DOCKER_NAME=$(docker run -d \
--cap-add=NET_ADMIN \
--cap-add=SYS_MODULE \
--sysctl="net.ipv4.conf.all.src_valid_mark=1" \
-e SERVERPORT=$WG_SERVER_PORT \
-e PEERS=1 \
-e INTERNAL_SUBNET=$WG_SUBNET \
-p $WG_SERVER_PORT:51820/udp \
-v $SRC_DIR:$ICPS_DOCKER_DIR \
-e PORT=$ICPS_PORT \
linuxserver/wireguard
)

SERVER_CONF="docker exec $DOCKER_NAME cat /config/wg0.conf"
CLIENT_CONF="docker exec $DOCKER_NAME cat /config/peer1/peer1.conf"
until $CLIENT_CONF > /dev/null 2>&1 && $SERVER_CONF > /dev/null 2>&1; do
echo -n '.'
sleep 5
done
echo

echo "Started wireguard tunnel (container name: $DOCKER_NAME) - listening on port $WG_SERVER_PORT"

# Start workflow
echo "Starting GH workflow $WORKFLOW_NAME"
gh workflow run $WORKFLOW_NAME \
-f "wg-endpoint=$($CLIENT_CONF | grep -oP '^Endpoint = \K.*$')" \
-f "wg-peer-public-key=$($CLIENT_CONF | grep -oP '^PublicKey = \K.*$')" \
-f "wg-local-address=$($CLIENT_CONF | grep -oP '^Address = \K.*$')" \
-f "wg-remote-address=$($SERVER_CONF | grep -oP '^Address = \K.*$')" \
-f "wg-allowed-ips=$($SERVER_CONF | grep -oP '^Address = \K.*$')" \
-f "wg-private-key=$($CLIENT_CONF | grep -oP '^PrivateKey = \K.*$')" \
-f "wg-preshared-key=$($CLIENT_CONF | grep -oP '^PresharedKey = \K.*$')"

WG_IP="$($CLIENT_CONF | grep -oP '^Address = \K.*$')"
echo -n "Waiting for MFA server to become available on host $WG_IP:$ICPS_PORT"

until docker exec $DOCKER_NAME nc -z ${WG_IP} ${ICPS_PORT}; do
echo -n '.'
sleep 5
done
echo "server available"

# Resend MFA code via SMS
docker exec $DOCKER_NAME $ICPS_RESEND_MFA_SCRIPT $MFA_METHOD $MFA_ID $WG_IP

echo "Please enter MFA code"
read MFA_CODE

# Send MFA code
docker exec $DOCKER_NAME $ICPS_ENTER_MFA_SCRIPT $MFA_CODE $WG_IP

sleep 5
echo "GH Secret should be updated:"
gh secret list | grep --color=never TEST_TRUST_TOKEN
19 changes: 19 additions & 0 deletions .github/actions/build/app-setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: build-app-setup
description: Sets up the environment for the app build action
inputs:
app-path:
description: The path to the app directory
required: false
default: app
runs:
using: composite
steps:
- id: setup-node
uses: actions/setup-node@v3
with:
node-version-file: ${{ inputs.app-path }}/node-version
cache: npm
cache-dependency-path: ${{ inputs.app-path }}
- id: setup-npm
shell: bash
run: (cd ${{ inputs.app-path }}; npm ci)
27 changes: 27 additions & 0 deletions .github/actions/build/app/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: build-app
description: Builds the JS application and uploads the artifact
inputs:
app-path:
description: The path to the app directory
required: false
default: app
artifact-name:
description: The name of the uploaded app artifact
required: false
default: app-artifact
runs:
using: composite
steps:
- id: build-app
shell: bash
run: (cd ${{ inputs.app-path }}; npm run build && npm run dist)
- id: package-artifact
shell: bash
run: |
fileName=$(cd ${{ inputs.app-path }}; npm pack)
mv ${{ inputs.app-path }}/$fileName npm-pack.tgz
- id: upload-artifact
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.artifact-name }}
path: npm-pack.tgz
26 changes: 26 additions & 0 deletions .github/actions/build/docker-setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: build-docker-setup
description: Sets up the environment for cross platform docker build action
inputs:
docker-path:
description: The path to the docker directory
required: false
default: docker
app-artifact-name:
description: The name of the uploaded app artifact
required: false
default: app-artifact
runs:
using: composite
steps:
- id: setup-qemu
uses: docker/setup-qemu-action@v2
- id: setup-buildx
uses: docker/setup-buildx-action@v2
- id: setup-app-artifact
uses: actions/download-artifact@v3
with:
name: ${{ inputs.app-artifact-name }}
path: ${{ inputs.docker-path }}/rootfs/opt/
- id: debug
shell: bash
run: ls -al ${{ inputs.docker-path }}/rootfs/opt/
Loading

0 comments on commit 43a728c

Please sign in to comment.