diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..3fee2ab --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,46 @@ +name: CI Build + +on: + pull_request: + branches: + - test-dev + paths-ignore: + - 'README.md' + - 'Release.md' + - '.github/workflows/release.yaml' + +jobs: + test: + runs-on: ubuntu-latest + permissions: + id-token: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Nix + uses: cachix/install-nix-action@v16 + + - name: Build Archive + id: build_archive + run: | + make archive + if [ ! -f "wire-docs.tar.gz" ]; then + echo "Artifact not found!" + exit 1 + fi + + - name: Configure AWS credentials for DEV + uses: aws-actions/configure-aws-credentials@v1 + with: + role-to-assume: ${{ secrets.DEV_AWS_ROLE_TO_ASSUME }} + aws-region: eu-west-1 + + - name: Deploy latest docs to S3 DEV account + run: | + mkdir -p tmp_extracted + tar -xzf ./wire-docs.tar.gz -C tmp_extracted + aws s3 sync tmp_extracted/latest s3://${{ secrets.DEV_BUCKET }}/latest + aws s3 sync tmp_extracted/site s3://${{ secrets.DEV_BUCKET }}/site + aws s3 cp tmp_extracted/versions.json s3://${{ secrets.DEV_BUCKET }}/versions.json + rm -rf tmp_extracted diff --git a/.overrides/404.html b/.overrides/404.html new file mode 100644 index 0000000..0cf2dc1 --- /dev/null +++ b/.overrides/404.html @@ -0,0 +1,33 @@ +{% extends "base.html" %} + +{% block content %} +
+

Page moved or not found

+

+ We've recently introduced versioning in our documentation. + The page you're looking for may have moved under a versioned path. +

+

+ You’ll be automatically redirected to the latest version of this page, if it exists. +

+

+ 👉 Redirect to /latest/... +

+
+{% endblock %} + +{% block scripts %} + +{% endblock %} diff --git a/build/build_versions.sh b/build/build_versions.sh index 68160f1..81bca08 100644 --- a/build/build_versions.sh +++ b/build/build_versions.sh @@ -60,7 +60,7 @@ git show-ref --tags | while read -r commit tag; do git checkout $TAG # pull the submodule - git submodule update --init wire-server + git submodule update --init --depth 1 wire-server # Check if tag exists in mike if [ -n "${existing_tags[$TAG]}" ]; then diff --git a/build/prepare.sh b/build/prepare.sh index 281a7e5..da67804 100644 --- a/build/prepare.sh +++ b/build/prepare.sh @@ -26,16 +26,16 @@ else fi; if [ -d "$TEMP_DIR/.git" ]; then - current_remote=$(git config --get remote.origin.url) + current_remote=$(git -C $TEMP_DIR config --get remote.origin.url) if [ "$current_remote" = "$ORIGINAL_DIR" ]; then cd $TEMP_DIR EXPECTED_AUTHOR="Wire Docs " - LAST_COMMIT_AUTHOR=$(git log -1 --pretty=format:"%an <%ae>") + LAST_COMMIT_AUTHOR=$(git -C $TEMP_DIR log -1 --pretty=format:"%an <%ae>") if [ "$LAST_COMMIT_AUTHOR" = "$EXPECTED_AUTHOR" ]; then echo "Last commit by $EXPECTED_AUTHOR detected. Removing it..." - git reset --hard HEAD~1 - git pull origin $(cat .current_branch) + git -C $TEMP_DIR reset --hard HEAD~1 + git -C $TEMP_DIR pull origin $(cat .current_branch) else echo "Last commit was not by $EXPECTED_AUTHOR. No action taken." fi