From 348b7c2c8927240b2f944c978ce32b07c3ac4148 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alain=20H=C3=A9la=C3=AFli?= Date: Mon, 15 Mar 2021 15:40:05 +0100 Subject: [PATCH 01/19] dummy test --- .github/workflows/test.yml | 75 +++++++++++++++++++ action.yml | 9 ++- sample_site/_config_multiple_versions.yml | 2 + .../e2e/cypress/integration/multiple/spec.js | 13 ++++ 4 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 sample_site/_config_multiple_versions.yml create mode 100644 tests/e2e/cypress/integration/multiple/spec.js diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index abc43d00..9a5d50d7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -428,4 +428,79 @@ jobs: name: cypress-videos-${{ runner.os }}-${{ matrix.node-version }} path: tests/e2e/videos + multiple-versions-publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: sample_site_gemfiles/vendor/bundle + key: gems-${{ hashFiles('**/Gemfile') }} + restore-keys: | + gems + - name: Basic run + uses: ./ + with: + jekyll_build_options: "--config ../sample_site/_config.yml,../sample_site/_config_multiple_versions.yml" + target_branch: multiple_versions_test_pages_branch + token: ${{ secrets.GITHUB_TOKEN }} + + multiple-versions-test: + runs-on: ubuntu-latest + needs: keep-history-test + steps: + - name: Set the GH Pages branch + uses: actions/github-script@v3 + with: + github-token: ${{secrets.JEKYLL_PAT}} # Need a PAT to switch the branch + script: | + await github.repos.updateInformationAboutPagesSite({ + owner: context.repo.owner, + repo: context.repo.repo, + source: { + branch: "multiple_versions_test_pages_branch", + path: "/" + } + }) + await github.repos.requestPagesBuild({ + owner: context.repo.owner, + repo: context.repo.repo + }) + - uses: actions/checkout@v2 + - name: Caching + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + - name: Get the URL of the rendered site + id: rendered-site-url + run: | + full_url=$(curl -sH "Authorization: token ${AUTH_TOKEN}" \ + "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/pages" | \ + awk -F'"' '/\"html_url\"/ { print $4 }') + url=$(dirname "${full_url}") + echo "::set-output name=url::${url}" + env: + AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Cypress run + uses: cypress-io/github-action@v2.7.2 + with: + config: baseUrl=${{ steps.rendered-site-url.outputs.url }} + working-directory: tests/e2e + spec: cypress/integration/multiple/**/* + - name: Save Cypress Screenshots + uses: actions/upload-artifact@v2 + if: failure() + with: + name: cypress-screenshots-${{ runner.os }}-${{ matrix.node-version }} + path: tests/e2e/screenshots + - name: Save Cypress Videos + uses: actions/upload-artifact@v2 + if: always() + with: + name: cypress-videos-${{ runner.os }}-${{ matrix.node-version }} + path: tests/e2e/videos + diff --git a/action.yml b/action.yml index 51b8a6eb..043b6411 100644 --- a/action.yml +++ b/action.yml @@ -10,6 +10,10 @@ inputs: jekyll_src: description: 'The Jekyll website source directory' required: false + ref_src: + description: 'The git ref to use as a source' + required: false + default: 'HEAD' jekyll_build_options: description: 'Additional Jekyll build arguments (see https://jekyllrb.com/docs/configuration/options/#build-command-options)' required: false @@ -17,7 +21,10 @@ inputs: description: 'The Jekyll Gemfile directory' required: false target_branch: - description: 'The target branch name the sources get pushed to' + description: 'The target branch name the site gets pushed to' + required: false + target_path: + description: 'The relative path where the site gets pushed to' required: false build_only: description: 'Will build the Jekyll site without publishing it' diff --git a/sample_site/_config_multiple_versions.yml b/sample_site/_config_multiple_versions.yml new file mode 100644 index 00000000..2eb2b518 --- /dev/null +++ b/sample_site/_config_multiple_versions.yml @@ -0,0 +1,2 @@ +title: Jekyll AsciiDoc Action - Multiple versions +test_id: multiple diff --git a/tests/e2e/cypress/integration/multiple/spec.js b/tests/e2e/cypress/integration/multiple/spec.js new file mode 100644 index 00000000..77965830 --- /dev/null +++ b/tests/e2e/cypress/integration/multiple/spec.js @@ -0,0 +1,13 @@ +it('works for the default branch', () => { + cy.visit('/jekyll-action/') + cy.get('#multiple').should('be.visible') + cy.get('body main div header h1').should('contain', 'Jekyll AsciiDoc Action - Multiple versions') +}) + +/* +it('works for the default branch on a different path', () => { + cy.visit('/jekyll-action/current') + cy.get('#multiple').should('be.visible') + cy.get('body main div header h1').should('contain', 'Jekyll AsciiDoc Action - Multiple versions') +}) +*/ From 951a03d15d796239d0a74e3e400b83f8203f86a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alain=20H=C3=A9la=C3=AFli?= Date: Mon, 15 Mar 2021 15:58:24 +0100 Subject: [PATCH 02/19] use the target path --- .github/workflows/test.yml | 8 ++++++++ entrypoint.sh | 12 +++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9a5d50d7..6b95ddf5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -444,6 +444,14 @@ jobs: jekyll_build_options: "--config ../sample_site/_config.yml,../sample_site/_config_multiple_versions.yml" target_branch: multiple_versions_test_pages_branch token: ${{ secrets.GITHUB_TOKEN }} + - name: Run with dest path + uses: ./ + with: + jekyll_build_options: "--config ../sample_site/_config.yml,../sample_site/_config_multiple_versions.yml" + target_branch: multiple_versions_test_pages_branch + keep_history: true + target_path: "current" + token: ${{ secrets.GITHUB_TOKEN }} multiple-versions-test: runs-on: ubuntu-latest diff --git a/entrypoint.sh b/entrypoint.sh index f837e5b3..14363577 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -28,8 +28,7 @@ else JEKYLL_SRC=$(find . -path '*/vendor/bundle' -prune -o -name '_config.yml' -exec dirname {} \;) JEKYLL_FILES_COUNT=$(echo "$JEKYLL_SRC" | wc -l) if [ "$JEKYLL_FILES_COUNT" != "1" ]; then - echo "::error::Found $JEKYLL_FILES_COUNT Jekyll sites! Please define which to use with input variable \"jekyll_src\"" - echo "$JEKYLL_SRC" + echo "::error::Found $JEKYLL_FILES_COUNT Jekyll sites from $JEKYLL_SRC! Please define which to use with input variable \"jekyll_src\"" exit 1 fi JEKYLL_SRC=$(echo $JEKYLL_SRC | tr -d '\n') @@ -87,6 +86,13 @@ echo "::debug::Build dir is ${BUILD_DIR}" mkdir $BUILD_DIR cd $BUILD_DIR +if [ -n "${INPUT_TARGET_PATH}" ]; then + TARGET_DIR="${BUILD_DIR}/${INPUT_TARGET_PATH}" + echo "::debug::target path is set to ${INPUT_TARGET_PATH}" +else + TARGET_DIR=$BUILD_DIR +fi + if [ "${INPUT_KEEP_HISTORY}" = true ]; then echo "::debug::Cloning ${remote_branch} from repo ${REMOTE_REPO}" git clone --branch $remote_branch $REMOTE_REPO . @@ -119,7 +125,7 @@ else echo "::debug::Jekyll debug is off" fi -JEKYLL_ENV=${INPUT_JEKYLL_ENV} bundle exec ${BUNDLE_ARGS} jekyll build -s ${GITHUB_WORKSPACE}/${JEKYLL_SRC} -d ${BUILD_DIR} ${INPUT_JEKYLL_BUILD_OPTIONS} ${VERBOSE} +JEKYLL_ENV=${INPUT_JEKYLL_ENV} bundle exec ${BUNDLE_ARGS} jekyll build -s ${GITHUB_WORKSPACE}/${JEKYLL_SRC} -d ${TARGET_DIR} ${INPUT_JEKYLL_BUILD_OPTIONS} ${VERBOSE} echo "Jekyll build done" if [ "${INPUT_BUILD_ONLY}" = true ]; then From 4d202b7c1a123d195ee18f149aa13cbe785b3913 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alain=20H=C3=A9la=C3=AFli?= Date: Mon, 15 Mar 2021 16:07:14 +0100 Subject: [PATCH 03/19] no need for that ref stuff --- action.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/action.yml b/action.yml index 043b6411..47989415 100644 --- a/action.yml +++ b/action.yml @@ -10,10 +10,6 @@ inputs: jekyll_src: description: 'The Jekyll website source directory' required: false - ref_src: - description: 'The git ref to use as a source' - required: false - default: 'HEAD' jekyll_build_options: description: 'Additional Jekyll build arguments (see https://jekyllrb.com/docs/configuration/options/#build-command-options)' required: false From 5cae77c07b0c8344338c35e26c8a75077b081f88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alain=20H=C3=A9la=C3=AFli?= Date: Mon, 15 Mar 2021 16:08:41 +0100 Subject: [PATCH 04/19] adding the simple path test --- tests/e2e/cypress/integration/multiple/spec.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/e2e/cypress/integration/multiple/spec.js b/tests/e2e/cypress/integration/multiple/spec.js index 77965830..370bd3cd 100644 --- a/tests/e2e/cypress/integration/multiple/spec.js +++ b/tests/e2e/cypress/integration/multiple/spec.js @@ -4,10 +4,8 @@ it('works for the default branch', () => { cy.get('body main div header h1').should('contain', 'Jekyll AsciiDoc Action - Multiple versions') }) -/* it('works for the default branch on a different path', () => { cy.visit('/jekyll-action/current') cy.get('#multiple').should('be.visible') cy.get('body main div header h1').should('contain', 'Jekyll AsciiDoc Action - Multiple versions') }) -*/ From 3fabf85a335ee929331c73ea0da6532fd385e7aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alain=20H=C3=A9la=C3=AFli?= Date: Mon, 15 Mar 2021 16:09:14 +0100 Subject: [PATCH 05/19] a different title for test --- sample_site/_config_multiple_versions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sample_site/_config_multiple_versions.yml b/sample_site/_config_multiple_versions.yml index 2eb2b518..7690691f 100644 --- a/sample_site/_config_multiple_versions.yml +++ b/sample_site/_config_multiple_versions.yml @@ -1,2 +1,2 @@ -title: Jekyll AsciiDoc Action - Multiple versions +title: Jekyll AsciiDoc Action - Multiple versions but older test_id: multiple From 01d77087e617368c19814bc9f645ba04f5082da5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alain=20H=C3=A9la=C3=AFli?= Date: Mon, 15 Mar 2021 16:18:38 +0100 Subject: [PATCH 06/19] publish old version too --- .github/workflows/test.yml | 13 +++++++++++++ sample_site/_config_multiple_versions.yml | 2 +- tests/e2e/cypress/integration/multiple/spec.js | 6 ++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6b95ddf5..d4e414af 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -452,6 +452,19 @@ jobs: keep_history: true target_path: "current" token: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/checkout@v2 + with: + ref: 'refs/tags/test-old-version' + - name: Run with dest path for older version + uses: ./ + with: + jekyll_build_options: "--config ../sample_site/_config.yml,../sample_site/_config_multiple_versions.yml" + target_branch: multiple_versions_test_pages_branch + keep_history: true + target_path: "old" + token: ${{ secrets.GITHUB_TOKEN }} + + multiple-versions-test: runs-on: ubuntu-latest diff --git a/sample_site/_config_multiple_versions.yml b/sample_site/_config_multiple_versions.yml index 7690691f..2eb2b518 100644 --- a/sample_site/_config_multiple_versions.yml +++ b/sample_site/_config_multiple_versions.yml @@ -1,2 +1,2 @@ -title: Jekyll AsciiDoc Action - Multiple versions but older +title: Jekyll AsciiDoc Action - Multiple versions test_id: multiple diff --git a/tests/e2e/cypress/integration/multiple/spec.js b/tests/e2e/cypress/integration/multiple/spec.js index 370bd3cd..1328961c 100644 --- a/tests/e2e/cypress/integration/multiple/spec.js +++ b/tests/e2e/cypress/integration/multiple/spec.js @@ -9,3 +9,9 @@ it('works for the default branch on a different path', () => { cy.get('#multiple').should('be.visible') cy.get('body main div header h1').should('contain', 'Jekyll AsciiDoc Action - Multiple versions') }) + +it('works for the default branch on a different path', () => { + cy.visit('/jekyll-action/old') + cy.get('#multiple').should('be.visible') + cy.get('body main div header h1').should('contain', 'Jekyll AsciiDoc Action - Multiple versions but older') +}) From 0c8a590f0f6fd5a7579072a6b817a5effc68aea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alain=20H=C3=A9la=C3=AFli?= Date: Mon, 15 Mar 2021 17:14:14 +0100 Subject: [PATCH 07/19] use a matrix --- .github/workflows/test.yml | 54 ++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d4e414af..4318ca2d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -428,47 +428,49 @@ jobs: name: cypress-videos-${{ runner.os }}-${{ matrix.node-version }} path: tests/e2e/videos + multiple-versions-prepare: + runs-on: ubuntu-latest + steps: + - name: Clean up branch + uses: actions/github-script@v3 + with: + github-token: ${{ secrets.JEKYLL_PAT }} + script: | + github.git.deleteRef( + { + owner: context.repo.owner, + repo: context.repo.repo, + ref: 'refs/heads/multiple_versions_test_pages_branch' + } + ) + multiple-versions-publish: runs-on: ubuntu-latest + needs: multiple-versions-prepare + strategy: + fail-fast: true + matrix: + env: [ + { path: '.', ref: 'refs/heads/master' }, + { path: 'current', ref: 'refs/heads/master' }, + { path: 'old', ref: 'refs/tags/test-old-version' } + ] steps: - uses: actions/checkout@v2 - - uses: actions/cache@v2 - with: - path: sample_site_gemfiles/vendor/bundle - key: gems-${{ hashFiles('**/Gemfile') }} - restore-keys: | - gems - - name: Basic run - uses: ./ with: - jekyll_build_options: "--config ../sample_site/_config.yml,../sample_site/_config_multiple_versions.yml" - target_branch: multiple_versions_test_pages_branch - token: ${{ secrets.GITHUB_TOKEN }} + ref: ${{ matrix.env.ref }} - name: Run with dest path uses: ./ with: jekyll_build_options: "--config ../sample_site/_config.yml,../sample_site/_config_multiple_versions.yml" target_branch: multiple_versions_test_pages_branch keep_history: true - target_path: "current" - token: ${{ secrets.GITHUB_TOKEN }} - - uses: actions/checkout@v2 - with: - ref: 'refs/tags/test-old-version' - - name: Run with dest path for older version - uses: ./ - with: - jekyll_build_options: "--config ../sample_site/_config.yml,../sample_site/_config_multiple_versions.yml" - target_branch: multiple_versions_test_pages_branch - keep_history: true - target_path: "old" + target_path: ${{ matrix.env.path }} token: ${{ secrets.GITHUB_TOKEN }} - - multiple-versions-test: runs-on: ubuntu-latest - needs: keep-history-test + needs: [keep-history-test, multiple-versions-publish] steps: - name: Set the GH Pages branch uses: actions/github-script@v3 From 5baf9cbda72812c1dc34fa380324793447e1a0d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alain=20H=C3=A9la=C3=AFli?= Date: Mon, 15 Mar 2021 17:17:15 +0100 Subject: [PATCH 08/19] shall I remove refs? --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4318ca2d..e9031e0e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -440,7 +440,7 @@ jobs: { owner: context.repo.owner, repo: context.repo.repo, - ref: 'refs/heads/multiple_versions_test_pages_branch' + ref: 'heads/multiple_versions_test_pages_branch' } ) From 43220cad7ffbcb8b8e45d1517d295ff91a62bd49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alain=20H=C3=A9la=C3=AFli?= Date: Mon, 15 Mar 2021 18:15:48 +0100 Subject: [PATCH 09/19] no path if path is / --- .github/workflows/test.yml | 6 +++--- entrypoint.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e9031e0e..f67b3a3c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -451,9 +451,9 @@ jobs: fail-fast: true matrix: env: [ - { path: '.', ref: 'refs/heads/master' }, - { path: 'current', ref: 'refs/heads/master' }, - { path: 'old', ref: 'refs/tags/test-old-version' } + { path: '/', ref: 'master' }, + { path: 'current', ref: 'master' }, + { path: 'old', ref: 'test-old-version' } ] steps: - uses: actions/checkout@v2 diff --git a/entrypoint.sh b/entrypoint.sh index 14363577..6057f027 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -86,7 +86,7 @@ echo "::debug::Build dir is ${BUILD_DIR}" mkdir $BUILD_DIR cd $BUILD_DIR -if [ -n "${INPUT_TARGET_PATH}" ]; then +if [ -n "${INPUT_TARGET_PATH}" ] && [ "${INPUT_TARGET_PATH}" != '/' ]; then TARGET_DIR="${BUILD_DIR}/${INPUT_TARGET_PATH}" echo "::debug::target path is set to ${INPUT_TARGET_PATH}" else From 26c7d42f1ff3581b7859cb328f86dfe5610f2ad2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alain=20H=C3=A9la=C3=AFli?= Date: Mon, 15 Mar 2021 18:21:08 +0100 Subject: [PATCH 10/19] ignore error when deleting branch --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f67b3a3c..a910080a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -430,6 +430,7 @@ jobs: multiple-versions-prepare: runs-on: ubuntu-latest + continue-on-error: true steps: - name: Clean up branch uses: actions/github-script@v3 From fbc54a8349c7ffad27644bebbcb923da811f4037 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alain=20H=C3=A9la=C3=AFli?= Date: Mon, 15 Mar 2021 18:28:43 +0100 Subject: [PATCH 11/19] who's dumb? --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a910080a..ccc289b8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -452,8 +452,8 @@ jobs: fail-fast: true matrix: env: [ - { path: '/', ref: 'master' }, - { path: 'current', ref: 'master' }, + { path: '/', ref: 'ref-to-publish' }, + { path: 'current', ref: 'ref-to-publish' }, { path: 'old', ref: 'test-old-version' } ] steps: From 5945069249093e6bc570d1d26ab27407a82887e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alain=20H=C3=A9la=C3=AFli?= Date: Mon, 15 Mar 2021 18:45:09 +0100 Subject: [PATCH 12/19] force push to clear repo --- .github/workflows/test.yml | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ccc289b8..d675ac0e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -433,17 +433,14 @@ jobs: continue-on-error: true steps: - name: Clean up branch - uses: actions/github-script@v3 - with: - github-token: ${{ secrets.JEKYLL_PAT }} - script: | - github.git.deleteRef( - { - owner: context.repo.owner, - repo: context.repo.repo, - ref: 'heads/multiple_versions_test_pages_branch' - } - ) + env: + AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git init + git config user.name "${GITHUB_ACTOR}" + git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" + git commit -m "empty commit" + git push --force https://${GITHUB_ACTOR}:${AUTH_TOKEN}/github.com/${GITHUB_REPOSITORY} multiple_versions_test_pages_branch multiple-versions-publish: runs-on: ubuntu-latest From 0e356174eb3bd5dfcd643c4d6df519cd82e54ead Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alain=20H=C3=A9la=C3=AFli?= Date: Mon, 15 Mar 2021 18:52:07 +0100 Subject: [PATCH 13/19] adding a real commit --- .github/workflows/test.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d675ac0e..6c42fc9f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -430,7 +430,6 @@ jobs: multiple-versions-prepare: runs-on: ubuntu-latest - continue-on-error: true steps: - name: Clean up branch env: @@ -439,7 +438,9 @@ jobs: git init git config user.name "${GITHUB_ACTOR}" git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" - git commit -m "empty commit" + echo "keep me" > .gitkeep + gita add .gitkeep + git commit "[skip ci] intial commit" git push --force https://${GITHUB_ACTOR}:${AUTH_TOKEN}/github.com/${GITHUB_REPOSITORY} multiple_versions_test_pages_branch multiple-versions-publish: From b11f0d1915aad055a105fba49a053351235521d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alain=20H=C3=A9la=C3=AFli?= Date: Mon, 15 Mar 2021 18:54:12 +0100 Subject: [PATCH 14/19] syntax error --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6c42fc9f..e16f5d3e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -439,7 +439,7 @@ jobs: git config user.name "${GITHUB_ACTOR}" git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" echo "keep me" > .gitkeep - gita add .gitkeep + git add .gitkeep git commit "[skip ci] intial commit" git push --force https://${GITHUB_ACTOR}:${AUTH_TOKEN}/github.com/${GITHUB_REPOSITORY} multiple_versions_test_pages_branch From dc465e85496507ae00a8b0365e3d295edee56e39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alain=20H=C3=A9la=C3=AFli?= Date: Mon, 15 Mar 2021 18:58:34 +0100 Subject: [PATCH 15/19] ooopsy --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e16f5d3e..4cacdf56 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -440,7 +440,7 @@ jobs: git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" echo "keep me" > .gitkeep git add .gitkeep - git commit "[skip ci] intial commit" + git commit -m "[skip ci] intial commit" git push --force https://${GITHUB_ACTOR}:${AUTH_TOKEN}/github.com/${GITHUB_REPOSITORY} multiple_versions_test_pages_branch multiple-versions-publish: From 9b7fd4df9a1054c26b2bbd30777f6a102d0d2ee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alain=20H=C3=A9la=C3=AFli?= Date: Mon, 15 Mar 2021 19:02:15 +0100 Subject: [PATCH 16/19] this is painful --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4cacdf56..6c60b381 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -438,10 +438,11 @@ jobs: git init git config user.name "${GITHUB_ACTOR}" git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" + git config --global init.defaultBranch main echo "keep me" > .gitkeep git add .gitkeep git commit -m "[skip ci] intial commit" - git push --force https://${GITHUB_ACTOR}:${AUTH_TOKEN}/github.com/${GITHUB_REPOSITORY} multiple_versions_test_pages_branch + git push --force https://${GITHUB_ACTOR}:${AUTH_TOKEN}@github.com/${GITHUB_REPOSITORY} main:multiple_versions_test_pages_branch multiple-versions-publish: runs-on: ubuntu-latest From f686e19b9c4661fa239a5c0d27e00c6ae2a820a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alain=20H=C3=A9la=C3=AFli?= Date: Mon, 15 Mar 2021 19:03:36 +0100 Subject: [PATCH 17/19] really? --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6c60b381..07994c12 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -435,10 +435,10 @@ jobs: env: AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | + git config --global init.defaultBranch main git init git config user.name "${GITHUB_ACTOR}" git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" - git config --global init.defaultBranch main echo "keep me" > .gitkeep git add .gitkeep git commit -m "[skip ci] intial commit" From 246f795e2fe3343edfe4689409c7ed45c8c9dece Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alain=20H=C3=A9la=C3=AFli?= Date: Tue, 23 Mar 2021 10:34:14 +0100 Subject: [PATCH 18/19] use separate sequential jobs --- .github/workflows/test.yml | 64 +++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 07994c12..a9f21699 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -427,50 +427,58 @@ jobs: with: name: cypress-videos-${{ runner.os }}-${{ matrix.node-version }} path: tests/e2e/videos - - multiple-versions-prepare: + + multiple-versions-slash-publish: runs-on: ubuntu-latest steps: - - name: Clean up branch - env: - AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - git config --global init.defaultBranch main - git init - git config user.name "${GITHUB_ACTOR}" - git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" - echo "keep me" > .gitkeep - git add .gitkeep - git commit -m "[skip ci] intial commit" - git push --force https://${GITHUB_ACTOR}:${AUTH_TOKEN}@github.com/${GITHUB_REPOSITORY} main:multiple_versions_test_pages_branch - - multiple-versions-publish: + - uses: actions/checkout@v2 + with: + ref: ref-to-publish + - name: Run with dest path + uses: ./ + with: + jekyll_build_options: "--config ../sample_site/_config.yml,../sample_site/_config_multiple_versions.yml" + target_branch: multiple_versions_test_pages_branch + keep_history: true + target_path: / + token: ${{ secrets.GITHUB_TOKEN }} + + multiple-versions-current-publish: runs-on: ubuntu-latest - needs: multiple-versions-prepare - strategy: - fail-fast: true - matrix: - env: [ - { path: '/', ref: 'ref-to-publish' }, - { path: 'current', ref: 'ref-to-publish' }, - { path: 'old', ref: 'test-old-version' } - ] + needs: multiple-versions-slash-publish steps: - uses: actions/checkout@v2 with: - ref: ${{ matrix.env.ref }} + ref: ref-to-publish - name: Run with dest path uses: ./ with: jekyll_build_options: "--config ../sample_site/_config.yml,../sample_site/_config_multiple_versions.yml" target_branch: multiple_versions_test_pages_branch keep_history: true - target_path: ${{ matrix.env.path }} + target_path: current + token: ${{ secrets.GITHUB_TOKEN }} + + multiple-versions-old-publish: + runs-on: ubuntu-latest + needs: multiple-versions-current-publish + steps: + - uses: actions/checkout@v2 + with: + ref: test-old-version + - name: Run with dest path + uses: ./ + with: + jekyll_build_options: "--config ../sample_site/_config.yml,../sample_site/_config_multiple_versions.yml" + target_branch: multiple_versions_test_pages_branch + keep_history: true + target_path: old token: ${{ secrets.GITHUB_TOKEN }} + multiple-versions-test: runs-on: ubuntu-latest - needs: [keep-history-test, multiple-versions-publish] + needs: [keep-history-test, multiple-versions-old-publish] steps: - name: Set the GH Pages branch uses: actions/github-script@v3 From 75496548118bd578d40f2110e8f5224b5c49b322 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alain=20H=C3=A9la=C3=AFli?= Date: Tue, 23 Mar 2021 15:39:31 +0100 Subject: [PATCH 19/19] [skip ci] switching tests to `master` --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a9f21699..f43d98a7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -433,7 +433,7 @@ jobs: steps: - uses: actions/checkout@v2 with: - ref: ref-to-publish + ref: master - name: Run with dest path uses: ./ with: @@ -449,7 +449,7 @@ jobs: steps: - uses: actions/checkout@v2 with: - ref: ref-to-publish + ref: master - name: Run with dest path uses: ./ with: