Skip to content
This repository has been archived by the owner on Jun 13, 2023. It is now read-only.

Test 154 and upgrade CI #155

Merged
merged 10 commits into from
Jan 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/actions/publish/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ runs:
using: "composite"
steps:
- name: Pages Publication
uses: actions/github-script@v3
uses: actions/github-script@v6
env:
SHA: ${{ inputs.sha }}
PAGES_BRANCH: ${{ inputs.branch }}
Expand All @@ -27,7 +27,7 @@ runs:
script: |
const {SHA, PAGES_BRANCH, PAGES_PATH} = process.env

await github.repos.updateInformationAboutPagesSite({
await github.rest.repos.updateInformationAboutPagesSite({
owner: context.repo.owner,
repo: context.repo.repo,
source: {
Expand All @@ -36,14 +36,14 @@ runs:
}
})

await github.repos.requestPagesBuild({
await github.rest.repos.requestPagesBuild({
owner: context.repo.owner,
repo: context.repo.repo
})

for (let retry = 1; retry <= 10; retry++) {
// Starting at 1 so the output message doesn't need manipulation
const {status, commit} = await github.repos.getLatestPagesBuild({
const {status, commit} = await github.rest.repos.getLatestPagesBuild({
owner: context.repo.owner,
repo: context.repo.repo
})
Expand Down
14 changes: 9 additions & 5 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ runs:
using: "composite"
steps:
- name: Caching
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
Expand All @@ -30,21 +30,25 @@ runs:
"${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/pages" | \
awk -F'"' '/\"html_url\"/ { print $4 }')
url=$(dirname "${full_url}")
echo "::set-output name=url::${url}"
echo "url=${url}" >> $GITHUB_OUTPUT
- name: Log the URL of the rendered site
shell: sh
run: echo ${{ steps.rendered-site-url.outputs.url }}
- name: Cypress run
uses: cypress-io/github-action@v2
uses: cypress-io/github-action@v5.0.5
with:
config: baseUrl=${{ steps.rendered-site-url.outputs.url }}
working-directory: tests/e2e
spec: ${{ inputs.spec }}
browser: chrome
- name: Save Cypress Screenshots
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots-${{ inputs.suffix }}
path: tests/e2e/cypress/screenshots
- name: Save Cypress Videos
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: always()
with:
name: cypress-videos-${{ inputs.suffix }}
Expand Down
81 changes: 41 additions & 40 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set the GH Pages branch
uses: actions/github-script@v3
uses: actions/github-script@v6
with:
github-token: ${{secrets.JEKYLL_PAT}}
script: |
await github.repos.updateInformationAboutPagesSite({
await github.rest.repos.updateInformationAboutPagesSite({
owner: context.repo.owner,
repo: context.repo.repo,
source: {
Expand All @@ -31,8 +31,8 @@ jobs:
outputs:
sha: ${{ steps.run.outputs.sha }}
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: sample_site_gemfiles/vendor/bundle
key: gems-${{ hashFiles('**/Gemfile') }}
Expand All @@ -46,13 +46,14 @@ jobs:
jekyll_env: development
build_only: false
pre_build_commands: apk --update add imagemagick nodejs
commit_author: "helaili"
token: ${{ secrets.GITHUB_TOKEN }}

basic_publish:
runs-on: ubuntu-latest
needs: [basic_run]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ./.github/actions/publish
with:
token: ${{ secrets.JEKYLL_PAT }}
Expand All @@ -64,7 +65,7 @@ jobs:
runs-on: ubuntu-latest
needs: [basic_publish]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ./.github/actions/test
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -77,8 +78,8 @@ jobs:
outputs:
sha: ${{ steps.run.outputs.sha }}
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: sample_site_gemfiles/vendor/bundle
key: gems-${{ hashFiles('**/Gemfile') }}
Expand All @@ -96,7 +97,7 @@ jobs:
runs-on: ubuntu-latest
needs: [build_dir_run, basic_test]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ./.github/actions/publish
with:
token: ${{ secrets.JEKYLL_PAT }}
Expand All @@ -108,7 +109,7 @@ jobs:
runs-on: ubuntu-latest
needs: [build_dir_publish]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ./.github/actions/test
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -120,11 +121,11 @@ jobs:
outputs:
sha: ${{ steps.run.outputs.sha }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Delete lock file
run: |
rm sample_site_gemfiles/Gemfile.lock
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: sample_site_gemfiles/vendor/bundle
key: gems-${{ hashFiles('**/Gemfile') }}
Expand All @@ -151,7 +152,7 @@ jobs:
runs-on: ubuntu-latest
needs: [build_dir_test, jekyll_bundler_run]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ./.github/actions/publish
with:
token: ${{ secrets.JEKYLL_PAT }}
Expand All @@ -163,7 +164,7 @@ jobs:
runs-on: ubuntu-latest
needs: jekyll_bundler_publish
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ./.github/actions/test
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -175,8 +176,8 @@ jobs:
outputs:
sha: ${{ steps.run.outputs.sha }}
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: sample_site_gemfiles/vendor/bundle
key: gems-${{ hashFiles('**/Gemfile') }}
Expand All @@ -198,7 +199,7 @@ jobs:
runs-on: ubuntu-latest
needs: [jekyll_bundler_test, jekyll_bundler_from_lock_run]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ./.github/actions/publish
with:
token: ${{ secrets.JEKYLL_PAT }}
Expand All @@ -210,7 +211,7 @@ jobs:
runs-on: ubuntu-latest
needs: jekyll_bundler_from_lock_publish
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ./.github/actions/test
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -222,8 +223,8 @@ jobs:
outputs:
sha: ${{ steps.run.outputs.sha }}
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: sample_site_gemfiles/vendor/bundle
key: gems-${{ hashFiles('**/Gemfile') }}
Expand All @@ -245,7 +246,7 @@ jobs:
runs-on: ubuntu-latest
needs: [jekyll_bundler_from_lock_test, jekyll_src_run]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ./.github/actions/publish
with:
token: ${{ secrets.JEKYLL_PAT }}
Expand All @@ -257,7 +258,7 @@ jobs:
runs-on: ubuntu-latest
needs: jekyll_src_publish
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ./.github/actions/test
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -267,8 +268,8 @@ jobs:
jekyll_gem_src_run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: sample_site_gemfiles/vendor/bundle
key: gems-${{ hashFiles('**/Gemfile') }}
Expand All @@ -287,7 +288,7 @@ jobs:
runs-on: ubuntu-latest
needs: [jekyll_src_test, jekyll_gem_src_run]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ./.github/actions/publish
with:
token: ${{ secrets.JEKYLL_PAT }}
Expand All @@ -299,7 +300,7 @@ jobs:
runs-on: ubuntu-latest
needs: [jekyll_gem_src_publish]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ./.github/actions/test
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -309,8 +310,8 @@ jobs:
build_only_run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: sample_site_gemfiles/vendor/bundle
key: gems-${{ hashFiles('**/Gemfile') }}
Expand All @@ -328,7 +329,7 @@ jobs:
runs-on: ubuntu-latest
needs: [jekyll_gem_src_test, build_only_run]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ./.github/actions/publish
with:
token: ${{ secrets.JEKYLL_PAT }}
Expand All @@ -340,7 +341,7 @@ jobs:
runs-on: ubuntu-latest
needs: build_only_publish
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ./.github/actions/test
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -350,7 +351,7 @@ jobs:
keep_history_prepare:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
ref: keep_history_test_pages_branch
- run: |
Expand All @@ -366,8 +367,8 @@ jobs:
runs-on: ubuntu-latest
needs: keep_history_prepare
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: sample_site_gemfiles/vendor/bundle
key: gems-${{ hashFiles('**/Gemfile') }}
Expand All @@ -386,7 +387,7 @@ jobs:
runs-on: ubuntu-latest
needs: [build_only_test, keep_history_run]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ./.github/actions/publish
with:
token: ${{ secrets.JEKYLL_PAT }}
Expand All @@ -398,7 +399,7 @@ jobs:
runs-on: ubuntu-latest
needs: keep_history_publish
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ./.github/actions/test
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -408,7 +409,7 @@ jobs:
multiple_versions_slash_publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
ref: master
- name: Run with dest path
Expand All @@ -423,7 +424,7 @@ jobs:
runs-on: ubuntu-latest
needs: multiple_versions_slash_publish
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
ref: master
- name: Run with dest path
Expand All @@ -439,7 +440,7 @@ jobs:
runs-on: ubuntu-latest
needs: multiple_versions_current_publish
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
ref: test-old-version
- name: Run with dest path
Expand All @@ -456,7 +457,7 @@ jobs:
runs-on: ubuntu-latest
needs: [keep_history_test, multiple_versions_old_publish]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ./.github/actions/publish
with:
token: ${{ secrets.JEKYLL_PAT }}
Expand All @@ -468,7 +469,7 @@ jobs:
runs-on: ubuntu-latest
needs: multiple_versions_publish
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ./.github/actions/test
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ keep_files: [.git, hello.html]
### bundler_version
When set override the default bundler version provided. If not given will attempt to resolve bundler version from `Gemfile.lock` if one exists.

### commit_author
When set override the default author of the commits to be performed. The default is to use the `GITHUB_ACTOR` environment variable, which is usually the owner of the `GITHUB_TOKEN` secret. The value can for example be set to `github-actions[bot]`. The corresponding email address is automatically set to `[commit_author]@users.noreply.github.com`.

## Use case: multi version publishing

Say you want to create a documentation website where you both have the current version (`v3.0`), but also `v1.0` and `v2.0`. You can then use a combination of `keep_history` and `target_path` along with the `actions/checkout@v2`action so that each version gets pushed in a separate folder without overwritting the previous one.
Expand Down
Loading