diff --git a/.github/workflows/remote_deploy.yml b/.github/workflows/remote_deploy.yml index 3d1bbc3..0bf37b6 100644 --- a/.github/workflows/remote_deploy.yml +++ b/.github/workflows/remote_deploy.yml @@ -36,9 +36,6 @@ jobs: # Parse JSON with multiline strings, using delimeter (Github specific) to_envs() { jq -r "to_entries[] | \"\(.key)<<$delim\n\(.value)\n$delim\n\""; } - # Set all vars - echo "GIT_BRANCH=${GIT_BRANCH}" >> $GITHUB_ENV - # Set VARS_CONTEXT if not null if [ "${VARS_CONTEXT}" != "null" ]; then echo "${VARS_CONTEXT}" | to_envs >> $GITHUB_ENV @@ -61,8 +58,8 @@ jobs: echo "Substituting variables from .env.example --> .env" ./envsubst < .env.example > .env else - echo ".env.example not found, creating .env with GIT_BRANCH only" - echo "GIT_BRANCH=${GIT_BRANCH}" > .env + echo ".env.example not found, creating .env" + touch .env fi echo "GIT_BRANCH=${GIT_BRANCH}" >> .env diff --git a/.github/workflows/test_compose.yml b/.github/workflows/test_compose.yml index d44e535..cdccfc6 100644 --- a/.github/workflows/test_compose.yml +++ b/.github/workflows/test_compose.yml @@ -73,6 +73,9 @@ on: type: string default: "test" +permissions: + contents: write + jobs: check-img-cache: runs-on: ubuntu-latest @@ -204,10 +207,6 @@ jobs: # Parse JSON with multiline strings, using delimeter (Github specific) to_envs() { jq -r "to_entries[] | \"\(.key)<<$delim\n\(.value)\n$delim\n\""; } - # Set all vars - echo "TAG_OVERRIDE=${TAG_OVERRIDE}" >> $GITHUB_ENV - echo "GIT_BRANCH=${GIT_BRANCH}" >> $GITHUB_ENV - # Set VARS_CONTEXT if not null if [ "${VARS_CONTEXT}" != "null" ]; then echo "${VARS_CONTEXT}" | to_envs >> $GITHUB_ENV @@ -230,11 +229,12 @@ jobs: echo "Substituting variables from .env.example --> .env" ./envsubst < .env.example > .env else - echo ".env.example not found, creating .env with GIT_BRANCH only" - echo "GIT_BRANCH=${GIT_BRANCH}" > .env + echo ".env.example not found, creating .env" + touch .env fi echo "GIT_BRANCH=${GIT_BRANCH}" >> .env + echo "TAG_OVERRIDE=${TAG_OVERRIDE}" >> .env - name: Run Tests if: ${{ ! inputs.coverage }} @@ -261,27 +261,18 @@ jobs: - name: Upload Coverage if: ${{ inputs.coverage }} run: | - # Pull content from gh-pages - mkdir tmp_pages - cd tmp_pages - git init + # Checkout to gh-pages git config user.name svchot git config user.email sysadmin@hotosm.org - git pull https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.wiki - cd .. - - # Sync coverage index and badge using rsync - sudo apt-get update && sudo apt-get install -y rsync --no-install-recommends + git checkout gh-pages + # Overwrite coverage index and badge echo "Coverage dir contents:" ls ${{ github.workspace }}/coverage echo "" - - cp ${{ github.workspace }}/coverage/coverage.* docs/ - rsync -av --delete docs/ tmp_pages/ --exclude .git + mv ${{ github.workspace }}/coverage/* ${{ github.workspace }} # Push content to gh-pages - cd tmp_pages git add . - git commit -m "docs: automated wiki update on push" - git push -f --set-upstream https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.wiki.git master + git commit -m "docs: update coverage summary and badge" + git push --set-upstream https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git gh-pages diff --git a/.github/workflows/test_pytest.yml b/.github/workflows/test_pytest.yml index c28f9dc..4708005 100644 --- a/.github/workflows/test_pytest.yml +++ b/.github/workflows/test_pytest.yml @@ -141,9 +141,6 @@ jobs: # Parse JSON with multiline strings, using delimeter (Github specific) to_envs() { jq -r "to_entries[] | \"\(.key)<<$delim\n\(.value)\n$delim\n\""; } - # Set all vars - echo "GIT_BRANCH=${GIT_BRANCH}" >> $GITHUB_ENV - # Set VARS_CONTEXT if not null if [ "${VARS_CONTEXT}" != "null" ]; then echo "${VARS_CONTEXT}" | to_envs >> $GITHUB_ENV @@ -166,8 +163,8 @@ jobs: echo "Substituting variables from .env.example --> .env" ./envsubst < .env.example > .env else - echo ".env.example not found, creating .env with GIT_BRANCH only" - echo "GIT_BRANCH=${GIT_BRANCH}" > .env + echo ".env.example not found, creating .env" + touch .env fi echo "GIT_BRANCH=${GIT_BRANCH}" >> .env