From 83d41b6220ced0d8d1d976190a9303379d5652cf Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Tue, 18 Oct 2022 20:47:29 +0200 Subject: [PATCH] CI: Fix workflow for the gh-pages (still ongoning?) [skip ci] [why] checkout-files checks out the last version on the push target branch, not the version we actually pushed. checkout clears all the workspace, so out file we want to commit is lost. [how] Use commit hash from just pushed commit. Use temporary directory outside of workspace to store the file. Unfortunately we haved to copy back because github-pages-deploy-action seems to take no absolute paths. Signed-off-by: Fini Jastrow --- .github/workflows/pages.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 39c9747ab..345545a78 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -5,6 +5,7 @@ on: branches: [ master ] paths: - bin/scripts/lib/fonts.json + workflow_dispatch: jobs: sync: @@ -14,22 +15,30 @@ jobs: uses: Bhacaz/checkout-files@v2 with: files: bin/scripts/lib/fonts.json - branch: ${{ github.head_ref || github.ref_name }} + branch: ${{ github.sha }} - name: Prepare file run: | - mkdir _data - cp bin/scripts/lib/fonts.json _data + echo "Temp dir is /tmp" + cp bin/scripts/lib/fonts.json /tmp + ls -l /tmp/fonts.json - name: Fetch gh-pages uses: actions/checkout@v3 with: ref: gh-pages + - name: Prepare file 2 + run: | + ls -l /tmp/fonts.json + mkdir temp_data + cp /tmp/fonts.json temp_data + - name: Deploy to gh-pages uses: JamesIves/github-pages-deploy-action@v4 with: - folder: _data + folder: temp_data + target-folder: _data commit-message: "[ci] Sync fonts.json" git-config-name: GitHub Actions git-config-email: 41898282+github-actions[bot]@users.noreply.github.com