From 99d4bdfff3fa29e7ff01f5ab9162fc48ef25862c Mon Sep 17 00:00:00 2001 From: Julien Bigot Date: Thu, 5 Dec 2024 13:16:15 +0900 Subject: [PATCH] ... --- .github/actions/deploy/Dockerfile | 8 ---- .github/actions/deploy/action.yml | 19 -------- .github/workflows/deploy.yml | 44 +++++++++---------- .../actions/deploy/entrypoint.sh => generate | 1 - 4 files changed, 20 insertions(+), 52 deletions(-) delete mode 100644 .github/actions/deploy/Dockerfile delete mode 100644 .github/actions/deploy/action.yml rename .github/actions/deploy/entrypoint.sh => generate (99%) diff --git a/.github/actions/deploy/Dockerfile b/.github/actions/deploy/Dockerfile deleted file mode 100644 index 90ec8f00..00000000 --- a/.github/actions/deploy/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -# Container image that runs your code -FROM alpine:3.10 - -COPY entrypoint.sh /entrypoint.sh - -RUN [ "apk", "add", "bash", "curl", "jq" ] - -ENTRYPOINT ["/entrypoint.sh"] diff --git a/.github/actions/deploy/action.yml b/.github/actions/deploy/action.yml deleted file mode 100644 index f7aa4363..00000000 --- a/.github/actions/deploy/action.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: 'Deploy' -description: 'Greet someone and record the time' -inputs: - output-directory: - description: 'Place where to put the new website data (relative to GITHUB_WORKSPACE)' - required: true - gitlab-url: - description: 'URL of the gitlab where to get data' - required: true - project-name: - description: 'Name of the project on the gitlab (urlencoded)' - required: true -runs: - using: 'docker' - image: 'Dockerfile' - args: - - ${{ inputs.output-directory }} - - ${{ inputs.gitlab-url }} - - ${{ inputs.project-name }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 39c44957..f289da4d 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -9,29 +9,25 @@ jobs: steps: - name: Checkout master uses: actions/checkout@v4 - with: { fetch-depth: 0 } - - name: Checkout gh-pages - run: git worktree add -B gh-pages public remotes/origin/gh-pages - name: Clean previous run: | - find public -mindepth 1 -maxdepth 1 '!' -name .git -exec rm -rf '{}' '+' - - name: Build site - uses: pdidev/pdidev.github.io/.github/actions/deploy@main - with: - output-directory: public - gitlab-url: https://gitlab.maisondelasimulation.fr - project-name: pdidev%2Fpdi - - name: Add static data - run: | - find data -mindepth 1 -maxdepth 1 -exec cp -r '{}' public ';' - - name: Add sitemap - run: | - ./gen_sitemap public - - name: Push - run: | - cd public - git config user.name "${GITHUB_ACTOR}" - git config user.email "${GITHUB_ACTOR}@noreply.example.com" - git add -A . - git commit -a -m "Update to match ${GITHUB_SHA} by ${GITHUB_EVENT_NAME} ${GITHUB_RUN_NUMBER}" - git push -f + export CI_PAGES_TOKEN="${{secrets.GITHUB_TOKEN}}" + ./generate _site https://gitlab.maisondelasimulation.fr pdidev%2Fpdi + find data -mindepth 1 -maxdepth 1 -exec cp -r '{}' _site ';' + ./gen_sitemap _site + - name: Upload page artifact + uses: actions/upload-pages-artifact@v3 + publish: + needs: build + if: "github.event_name != 'pull_request'" + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.github/actions/deploy/entrypoint.sh b/generate similarity index 99% rename from .github/actions/deploy/entrypoint.sh rename to generate index 92abb26a..7912ed32 100755 --- a/.github/actions/deploy/entrypoint.sh +++ b/generate @@ -8,7 +8,6 @@ then fi DEPLOY_DIR="${1}" -cd "${GITHUB_WORKSPACE}" mkdir -p "${DEPLOY_DIR}" cd "${DEPLOY_DIR}" DEPLOY_DIR="${PWD}"