Skip to content

Commit

Permalink
refactor(CI/CD): replace shell script by JavaScript (#3454)
Browse files Browse the repository at this point in the history
* refactor(CI/CD): replace shell by JavaScript

* refactor: we obviously need to provide and export that function

* refactor: removed that file again

* refactor: migrated another script

* refactor: removed incorrect import

* chore: removed leftover

* refactor: this was way too complicated

* refactor: migrated another script

* refactor: added dependency

* Revert "refactor: added dependency"

This reverts commit 54a0475.

* Reapply "refactor: added dependency"

This reverts commit 95d0bbd.

* refactor: corrected this implementation

* chore: another try

* chore: test typescript support for github scripts

* chore: update paths for github scripts

* chore: update tests for scripts

* fix: issue with wrong path

* fix: issue with wrong path

* fix: issue with tsx

* fix: issue with path

* fix: issue with path

* Update scripts/tests/github/build-gh-page.spec.ts

Co-authored-by: Maximilian Franzke <[email protected]>

* Update scripts/tests/github/get-release.spec.ts

Co-authored-by: Maximilian Franzke <[email protected]>

* Update scripts/tests/github/get-release.spec.ts

Co-authored-by: Maximilian Franzke <[email protected]>

* Update scripts/tests/github/get-release.spec.ts

Co-authored-by: Maximilian Franzke <[email protected]>

* Update scripts/tests/github/build-gh-page.spec.ts

Co-authored-by: Maximilian Franzke <[email protected]>

* Update scripts/tests/github/get-playwright-version.spec.ts

Co-authored-by: Maximilian Franzke <[email protected]>

* Update scripts/tests/github/get-playwright-version.spec.ts

Co-authored-by: Maximilian Franzke <[email protected]>

* Update .xo-config.cjs

* refactor: regenerated package lock file

* refactor: xo aspects

* refactor: we don't push to GitHub at the moment

---------

Co-authored-by: Nicolas Merget <[email protected]>
Co-authored-by: Nicolas Merget <[email protected]>
  • Loading branch information
3 people authored Jan 28, 2025
1 parent 8448662 commit 7c8283c
Show file tree
Hide file tree
Showing 29 changed files with 2,024 additions and 453 deletions.
54 changes: 0 additions & 54 deletions .github/scripts/build-gh-page.sh

This file was deleted.

17 changes: 0 additions & 17 deletions .github/scripts/get-release.sh

This file was deleted.

22 changes: 0 additions & 22 deletions .github/scripts/package-version.sh

This file was deleted.

66 changes: 0 additions & 66 deletions .github/scripts/publish-npm.sh

This file was deleted.

11 changes: 4 additions & 7 deletions .github/workflows/01-get-playwright-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
name: Get and save publish version
runs-on: ubuntu-24.04 # Use Ubuntu 24.04 explicitly
outputs:
version: ${{ steps.version.outputs.result }}
version: ${{ steps.version.outputs.version }}
steps:
- name: ⏬ Checkout repo
uses: actions/checkout@v4
Expand All @@ -22,13 +22,10 @@ jobs:
uses: ./.github/actions/npm-cache

- name: 🪁 Get playwright version
uses: actions/github-script@v7
id: version
with:
result-encoding: string
script: |
const { default: getPlaywrightVersion } = await import('${{ github.workspace }}/.github/scripts/get-playwright-version.js');
return await getPlaywrightVersion();
run: |
OUTPUT=$(npx --no tsx scripts/github/get-playwright-version.ts)
echo "version=$OUTPUT" >> $GITHUB_OUTPUT
- name: 💀 Killing me softly
uses: ./.github/actions/cancel-workflow
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/01-get-publish-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ jobs:
- name: 💃🕺 Check if release or prerelease
id: releaseCheck
run: |
chmod +rx ./.github/scripts/get-release.sh
OUTPUT=$(./.github/scripts/get-release.sh)
OUTPUT=$(npx --no tsx scripts/github/get-release.ts)
if [[ $OUTPUT == "RELEASE" ]];
then
echo "release=true" >> $GITHUB_OUTPUT
Expand All @@ -60,8 +59,7 @@ jobs:
PRE_RELEASE: ${{ steps.releaseCheck.outputs.preRelease }}
TAG: ${{ steps.extractTag.outputs.tag }}
run: |
chmod +rx ./.github/scripts/package-version.sh
OUTPUT=$(./.github/scripts/package-version.sh)
OUTPUT=$(npx --no tsx scripts/github/package-version.ts)
echo "version=$OUTPUT" >> $GITHUB_OUTPUT
- name: 🌳 Log Valid Version
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/03-deploy-gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ jobs:
REPO_NAME: ${{ steps.repo-name.outputs.result }}
OWNER_NAME: ${{ github.repository_owner }}
run: |
chmod +rx ./.github/scripts/build-gh-page.sh
./.github/scripts/build-gh-page.sh
npx --no tsx scripts/github/build-gh-page.ts
- name: 🥅 Deploy to GH-Pages
uses: peaceiris/actions-gh-pages@v4
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/03-publish-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ jobs:

- name: 📰 Publish to NPM Registries
run: |
chmod +rx ./.github/scripts/publish-npm.sh
./.github/scripts/publish-npm.sh
node scripts/github/publish-npm.js
env:
RELEASE: ${{ inputs.release }}
PRE_RELEASE: ${{ inputs.preRelease }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
with:
result-encoding: json
script: |
const { default: cleanUpPages } = await import('${{ github.workspace }}/.github/scripts/cleanup-gh-pages.js');
const { default: cleanUpPages } = await import('${{ github.workspace }}/scripts/github/cleanup-gh-pages.js');
return await cleanUpPages({github, context});
- name: 🥅 Deploy to GH-Pages
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,6 @@ showcases/patternhub/public/iframe-resizer/*
/output/stencil/loader
/output/stencil/www
**/.angular
/scripts/public/
/scripts/gh-pages.tar.gz
!/scripts/tests/fixtures/out
12 changes: 12 additions & 0 deletions .xo-config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@ module.exports = {
// Playwright tests are async we shall use loops there
'no-await-in-loop': 0
}
},
{
files: ['./scripts/**'],
rules: {
// We could set the correct path to package.json for the following folder, as we're only using the scripts package as an abtraction, but list those dependencies in roots package.json file
'import/no-extraneous-dependencies': [
'error',
{ packageDir: './' }
],
// Node.js environment
'no-console': 'off'
}
}
],
rules: {
Expand Down
Loading

0 comments on commit 7c8283c

Please sign in to comment.