diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index b7542b6..5472ad3 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,3 +1,3 @@ # https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners -* @lotyp @jevgenijsblaus +* @lotyp @roxblnfk diff --git a/.github/ISSUE_TEMPLATE/1-bug-report.yml b/.github/ISSUE_TEMPLATE/1-bug-report.yml index 11946b4..4cc223c 100644 --- a/.github/ISSUE_TEMPLATE/1-bug-report.yml +++ b/.github/ISSUE_TEMPLATE/1-bug-report.yml @@ -96,8 +96,8 @@ body: value: | ๐Ÿ“› To ensure a smooth issue processing, please check if a similar bug report has already been submitted before creating a new one. We highly value your contributions, so please make sure to familiarize yourself with our repository's guidelines: - - [Code of Conduct](https://github.com/wayofdev/gh-actions/blob/master/.github/CODE_OF_CONDUCT.md) - - [Contribution Guidelines](https://github.com/wayofdev/gh-actions/blob/master/.github/CONTRIBUTING.md) + - [Code of Conduct](https://github.com/cycle/gh-actions/blob/master/.github/CODE_OF_CONDUCT.md) + - [Contribution Guidelines](https://github.com/cycle/gh-actions/blob/master/.github/CONTRIBUTING.md) Additionally, consider joining our discussions on: - [WayOfDev Discord Community](https://discord.gg/CE3TcCC5vr) diff --git a/.github/ISSUE_TEMPLATE/2-feature-request.yml b/.github/ISSUE_TEMPLATE/2-feature-request.yml index 564b25e..b1ef8e5 100644 --- a/.github/ISSUE_TEMPLATE/2-feature-request.yml +++ b/.github/ISSUE_TEMPLATE/2-feature-request.yml @@ -66,8 +66,8 @@ body: value: | ๐Ÿ“› To ensure a smooth issue processing, please check if a similar feature request has already been submitted before creating a new one. We highly value your contributions, so please make sure to familiarize yourself with our repository's guidelines: - - [Code of Conduct](https://github.com/wayofdev/gh-actions/blob/master/.github/CODE_OF_CONDUCT.md) - - [Contribution Guidelines](https://github.com/wayofdev/gh-actions/blob/master/.github/CONTRIBUTING.md) + - [Code of Conduct](https://github.com/cycle/gh-actions/blob/master/.github/CODE_OF_CONDUCT.md) + - [Contribution Guidelines](https://github.com/cycle/gh-actions/blob/master/.github/CONTRIBUTING.md) Additionally, consider joining our discussions on: - [WayOfDev Discord Community](https://discord.gg/CE3TcCC5vr) diff --git a/.github/ISSUE_TEMPLATE/3-failing-test.yml b/.github/ISSUE_TEMPLATE/3-failing-test.yml index 7a17d2c..b5bca9f 100644 --- a/.github/ISSUE_TEMPLATE/3-failing-test.yml +++ b/.github/ISSUE_TEMPLATE/3-failing-test.yml @@ -54,8 +54,8 @@ body: value: | ๐Ÿ“› To ensure a smooth issue processing, please check if a similar bug report has already been submitted before creating a new one. We highly value your contributions, so please make sure to familiarize yourself with our repository's guidelines: - - [Code of Conduct](https://github.com/wayofdev/gh-actions/blob/master/.github/CODE_OF_CONDUCT.md) - - [Contribution Guidelines](https://github.com/wayofdev/gh-actions/blob/master/.github/CONTRIBUTING.md) + - [Code of Conduct](https://github.com/cycle/gh-actions/blob/master/.github/CODE_OF_CONDUCT.md) + - [Contribution Guidelines](https://github.com/cycle/gh-actions/blob/master/.github/CONTRIBUTING.md) Additionally, consider joining our discussions on: - [WayOfDev Discord Community](https://discord.gg/CE3TcCC5vr) diff --git a/.github/ISSUE_TEMPLATE/4-docs-bug-report.yml b/.github/ISSUE_TEMPLATE/4-docs-bug-report.yml index e930f20..8de8d79 100644 --- a/.github/ISSUE_TEMPLATE/4-docs-bug-report.yml +++ b/.github/ISSUE_TEMPLATE/4-docs-bug-report.yml @@ -70,8 +70,8 @@ body: value: | ๐Ÿ“› To ensure a smooth issue processing, please check if a similar bug report has already been submitted before creating a new one. We highly value your contributions, so please make sure to familiarize yourself with our repository's guidelines: - - [Code of Conduct](https://github.com/wayofdev/gh-actions/blob/master/.github/CODE_OF_CONDUCT.md) - - [Contribution Guidelines](https://github.com/wayofdev/gh-actions/blob/master/.github/CONTRIBUTING.md) + - [Code of Conduct](https://github.com/cycle/gh-actions/blob/master/.github/CODE_OF_CONDUCT.md) + - [Contribution Guidelines](https://github.com/cycle/gh-actions/blob/master/.github/CONTRIBUTING.md) Additionally, consider joining our discussions on: - [WayOfDev Discord Community](https://discord.gg/CE3TcCC5vr) diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml deleted file mode 100644 index 5c314f2..0000000 --- a/.github/workflows/build-image.yml +++ /dev/null @@ -1,111 +0,0 @@ ---- - -on: # yamllint disable-line rule:truthy - workflow_call: - inputs: - os: - description: The operating system to run the workflow on - required: false - type: string - default: ubuntu-latest - push-to-hub: - description: Push the image to Docker Hub - required: false - type: boolean - default: false - image-namespace: - description: 'The namespace of the image, example: wayofdev/php-base' - required: true - type: string - image-template-path: - description: 'The path to the template of the image, example: ./dist/base' - required: true - type: string - image-template: - description: 'The template of the image, example: 8.2-fpm-alpine' - required: true - type: string - image-version: - description: 'The version of the image, example: latest' - required: true - type: string - image-platform: - description: The platform of the image - required: false - type: string - default: linux/amd64,linux/arm64 - secrets: - docker-username: - description: Docker Hub username - required: true - docker-password: - description: Docker Hub password - required: true - -name: ๐Ÿš€ Build docker images - -jobs: - build: - runs-on: ${{ inputs.os }} - steps: - - name: ๐Ÿ“ฆ Check out the codebase - uses: actions/checkout@v4 - - - name: ๐Ÿ› ๏ธ Install goss and dgoss - uses: e1himself/goss-installation-action@v1.2.1 - with: - version: v0.4.6 - - - name: ๐Ÿค– Generate dist files - run: make generate - - - name: ๐Ÿณ Extract docker meta data - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ inputs.image-namespace }} - tags: | - type=raw,event=branch,value=latest - type=ref,event=pr - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - flavor: | - latest=false - prefix=${{ inputs.image-template }}- - - - name: ๐Ÿ”‘ Login to docker-hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.docker-username }} - password: ${{ secrets.docker-password }} - - - name: ๐Ÿ–ฅ๏ธ Setup QEMU for "${{ inputs.image-platform }}" - uses: docker/setup-qemu-action@v3 - with: - platforms: ${{ inputs.image-platform }} - - - name: ๐Ÿ› ๏ธ Setup docker BuildX for "${{ inputs.image-platform }}" - uses: docker/setup-buildx-action@v3 - with: - install: true - platforms: ${{ inputs.image-platform }} - - - name: ๐Ÿš€ Build image and push to docker-hub for "${{ inputs.image-platform }}" - uses: docker/build-push-action@v5 - with: - context: '${{ inputs.image-template-path }}/${{ inputs.image-template }}' - platforms: ${{ inputs.image-platform }} - push: ${{ inputs.push-to-hub == true }} - tags: ${{ steps.meta.outputs.tags }} - cache-from: type=registry,ref=${{ inputs.image-namespace }}:${{ inputs.image-template }}-cache - cache-to: type=registry,ref=${{ inputs.image-namespace }}:${{ inputs.image-template }}-cache,mode=max - labels: ${{ steps.meta.outputs.labels }} - - - name: ๐Ÿงช Test Docker image - if: ${{ inputs.image-platform == 'linux/amd64' }} - run: | - export IMAGE_TEMPLATE=${{ inputs.image-template }} - export IMAGE_TAG=${{ inputs.image-namespace }}:${{ inputs.image-template }}-${{ inputs.image-version }} - make test - -... diff --git a/.github/workflows/create-changesets-release.yml b/.github/workflows/create-changesets-release.yml deleted file mode 100644 index 05865b5..0000000 --- a/.github/workflows/create-changesets-release.yml +++ /dev/null @@ -1,65 +0,0 @@ ---- - -name: Create release or publish to pnpm reusable workflow -on: # yamllint disable-line rule:truthy - workflow_call: - inputs: - os: - description: The operating system to run the workflow on - required: false - type: string - default: ubuntu-latest - node: - description: The node version to use when creating the release - required: false - type: string - default: 18 - repository: - description: The repository to use when creating the release - required: true - type: string - secrets: - token: - required: true - npm_token: - required: true - -jobs: - release: - if: ${{ github.repository == inputs.repository && contains('refs/heads/master', github.ref)}} - runs-on: ${{ inputs.os }} - - steps: - - name: ๐Ÿ“ฆ Check out the codebase - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: โš™๏ธ Setup node ${{ inputs.node }} - uses: actions/setup-node@v4 - with: - node-version: ${{ inputs.node }} - registry-url: 'https://registry.npmjs.org/' - - - name: ๐Ÿ“ฅ Monorepo install - uses: wayofdev/gh-actions/actions/pnpm-install@master - with: - enable-corepack: false - cache-node-modules: true - - - name: ๐Ÿฆ‹ Create release pull request or publish to npm - id: changesets - uses: changesets/action@v1 - with: - commit: 'chore: update versions' - title: 'chore: update versions' - cwd: ${{ github.workspace }} - publish: pnpm run cs:publish - version: pnpm run cs:version - setupGitUser: true - env: - HOME: ${{ github.workspace }} - GITHUB_TOKEN: ${{ secrets.token }} - NPM_TOKEN: ${{ secrets.npm_token }} - -... diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml deleted file mode 100644 index f580970..0000000 --- a/.github/workflows/create-release.yml +++ /dev/null @@ -1,37 +0,0 @@ ---- - -# https://github.com/google-github-actions/release-please-action#release-types-supported - -on: # yamllint disable-line rule:truthy - workflow_call: - inputs: - os: - description: The operating system to run the workflow on - required: false - type: string - default: ubuntu-latest - branch: - description: 'The branch to use when creating the release, example: master' - required: true - type: string - secrets: - token: - description: The GitHub token to use when creating the release - required: true - -name: ๐Ÿ“ฆ Create release - -jobs: - release: - runs-on: ${{ inputs.os }} - steps: - - name: ๐ŸŽ‰ Create release - uses: google-github-actions/release-please-action@v4 - id: release - with: - token: ${{ secrets.token }} - config-file: ${{ github.workspace }}/.github/.release-please-config.json - manifest-file: ${{ github.workspace }}/.github/.release-please-manifest.json - target-branch: ${{ inputs.branch }} - -... diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e1245aa..c50cfa6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,5 @@ --- -# https://github.com/wayofdev/gh-actions/blob/master/.github/workflows/create-release.yml # https://github.com/google-github-actions/release-please-action#release-types-supported # https://github.com/googleapis/release-please/blob/main/docs/customizing.md @@ -19,7 +18,7 @@ jobs: uses: google-github-actions/release-please-action@v4 id: release with: - token: ${{ secrets.PERSONAL_GITHUB_TOKEN }} + token: ${{ secrets.GITHUB_TOKEN }} config-file: .github/.release-please-config.json manifest-file: .github/.release-please-manifest.json target-branch: master diff --git a/.github/workflows/triage.yml b/.github/workflows/triage.yml index d84e66e..b2b9a49 100644 --- a/.github/workflows/triage.yml +++ b/.github/workflows/triage.yml @@ -16,7 +16,7 @@ name: ๐Ÿท๏ธ Add labels jobs: label: - uses: wayofdev/gh-actions/.github/workflows/apply-labels.yml@v3.0.0 + uses: cycle/gh-actions/.github/workflows/apply-labels.yml@v3.0.0 with: os: ubuntu-latest secrets: diff --git a/Makefile b/Makefile index 7bf1c19..854e0ed 100644 --- a/Makefile +++ b/Makefile @@ -49,9 +49,9 @@ help: ## Show this menu @echo @echo ' ๐Ÿ“‘ Logs are stored in $(MAKE_LOGFILE)' @echo - @echo ' ๐Ÿ“ฆ Package gh-actions (github.com/wayofdev/gh-actions)' + @echo ' ๐Ÿ“ฆ Package gh-actions (github.com/cycle/gh-actions)' @echo ' ๐Ÿค  Author Andrij Orlenko (github.com/lotyp)' - @echo ' ๐Ÿข ${YELLOW}Org wayofdev (github.com/wayofdev)${RST}' + @echo ' ๐Ÿข ${YELLOW}Org cycle (github.com/cycle)${RST}' @echo .PHONY: help diff --git a/README.md b/README.md index e963759..f3ffc3e 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,23 @@ -
-
-WayOfDev Logo for light theme -WayOfDev Logo for dark theme + + + + + +

-
-
-Build Status -Software License -Commits since latest release -Conventional Commits -Codecov -Follow on Twitter -
-
+[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fwayofdev%2Fgh-actions%2Fbadge&style=flat-square)](https://github.com/cycle/gh-actions/actions) +[![Software License](https://img.shields.io/github/license/cycle/gh-actions.svg?style=flat-square&color=blue)](LICENSE.md) +[![Commits since latest release](https://img.shields.io/github/commits-since/cycle/gh-actions/latest?style=flat-square)](https://github.com/cycle/gh-actions) +[![Discord](https://img.shields.io/discord/538114875570913290?style=flat-square&logo=discord&labelColor=7289d9&logoColor=white&color=39456d)](https://discord.gg/spiralphp) +[![Follow on Twitter](https://img.shields.io/twitter/follow/SpiralScout.svg?style=flat-square&logo=x&color=6e7781)](https://twitter.com/intent/follow?screen_name=SpiralScout) + + # Shared GitHub Actions @@ -34,7 +33,6 @@ These tools encapsulate common and repetitive tasks, allowing for easy integrati - [Composite Actions](#-composite-actions) - [Workflows](#-workflows) - [Auto Label and Release Management](#-auto-label-and-release-management) - - [Docker Workflows](#-docker-workflows) - [Code Architecture](#-code-architecture) - [Static Analysis](#-static-analysis) - [License](#-license) @@ -104,7 +102,7 @@ name: ๐Ÿท๏ธ Add labels jobs: label: - uses: wayofdev/gh-actions/.github/workflows/apply-labels.yml@master + uses: cycle/gh-actions/.github/workflows/apply-labels.yml@master with: os: ubuntu-latest secrets: @@ -165,7 +163,7 @@ name: ๐Ÿคž Auto merge release jobs: auto-merge: - uses: wayofdev/gh-actions/.github/workflows/auto-merge-release.yml@master + uses: cycle/gh-actions/.github/workflows/auto-merge-release.yml@master with: os: ubuntu-latest pull-request-number: ${{ github.event.pull_request.number }} @@ -203,7 +201,7 @@ name: ๐Ÿฆ‹ Create release or publish to pnpm jobs: release: - uses: wayofdev/gh-actions/.github/workflows/create-changesets-release.yml@master + uses: cycle/gh-actions/.github/workflows/create-changesets-release.yml@master with: node: 18 repository: wayofdev/next-starter-tpl @@ -272,7 +270,7 @@ jobs: needs: prepare strategy: matrix: ${{ fromJson(needs.prepare.outputs.matrix )}} - uses: wayofdev/gh-actions/.github/workflows/build-image.yml@master + uses: cycle/gh-actions/.github/workflows/build-image.yml@master with: os: "ubuntu-latest" push-to-hub: true @@ -324,7 +322,7 @@ permissions: read-all jobs: codesee: - uses: wayofdev/gh-actions/.github/workflows/create-arch-diagram.yml@master + uses: cycle/gh-actions/.github/workflows/create-arch-diagram.yml@master with: os: ubuntu-latest continue-on-error: true @@ -363,7 +361,7 @@ permissions: jobs: shellcheck: - uses: wayofdev/gh-actions/.github/workflows/shellcheck.yml@master + uses: cycle/gh-actions/.github/workflows/shellcheck.yml@master with: os: ubuntu-latest severity: warning @@ -380,7 +378,7 @@ Real-world examples can be found in the [`wayofdev/laravel-package-tpl`](https:/ ## ๐Ÿค License -[![Licence](https://img.shields.io/github/license/wayofdev/gh-actions?style=for-the-badge&color=blue)](./LICENSE) +[![Licence](https://img.shields.io/github/license/cycle/gh-actions?style=for-the-badge&color=blue)](./LICENSE)
@@ -428,6 +426,6 @@ Created in **2023** by [lotyp](https://github.com/wayofdev) @ [wayofdev](https:/ ## ๐Ÿซก Contributors -Contributors Badge +Contributors Badge
diff --git a/actions/composer/get-cache-directory/README.md b/actions/composer/get-cache-directory/README.md index 34d4e97..c32cabf 100644 --- a/actions/composer/get-cache-directory/README.md +++ b/actions/composer/get-cache-directory/README.md @@ -1,15 +1,15 @@
-WayOfDev Logo for light theme -WayOfDev Logo for dark theme +WayOfDev Logo for light theme +WayOfDev Logo for dark theme


-Build Status -Software License -Commits since latest release +Build Status +Software License +Commits since latest release Conventional Commits Codecov @@ -48,7 +48,7 @@ jobs: # ... - name: ๐ŸŽฏ Get Composer Cache Directory - uses: wayofdev/gh-actions/actions/composer/get-cache-directory@master + uses: cycle/gh-actions/actions/composer/get-cache-directory@master with: working-directory: '.' diff --git a/actions/composer/get-root-version/README.md b/actions/composer/get-root-version/README.md index ac58122..6de7e8b 100644 --- a/actions/composer/get-root-version/README.md +++ b/actions/composer/get-root-version/README.md @@ -1,15 +1,15 @@
-WayOfDev Logo for light theme -WayOfDev Logo for dark theme +WayOfDev Logo for light theme +WayOfDev Logo for dark theme


-Build Status -Software License -Commits since latest release +Build Status +Software License +Commits since latest release Codecov
@@ -47,7 +47,7 @@ jobs: # ... - name: ๐ŸŽฏ Get Composer Root Version - uses: wayofdev/gh-actions/actions/composer/get-root-version@master + uses: cycle/gh-actions/actions/composer/get-root-version@master with: branch: master working-directory: '.' diff --git a/actions/composer/install/README.md b/actions/composer/install/README.md index cb5abae..9228fbe 100644 --- a/actions/composer/install/README.md +++ b/actions/composer/install/README.md @@ -1,17 +1,17 @@
-WayOfDev Logo for light theme -WayOfDev Logo for dark theme +WayOfDev Logo for light theme +WayOfDev Logo for dark theme


-Build Status -Software License -Commits since latest release +Build Status +Software License +Commits since latest release Codecov
@@ -63,7 +63,7 @@ jobs: # ... - name: ๐Ÿ“ฅ Install "${{ matrix.dependencies }}" dependencies - uses: wayofdev/gh-actions/actions/composer/install@master + uses: cycle/gh-actions/actions/composer/install@master with: dependencies: ${{ matrix.dependencies }} working-directory: '.' diff --git a/actions/phive/install/README.md b/actions/phive/install/README.md index 0443c63..12ead74 100644 --- a/actions/phive/install/README.md +++ b/actions/phive/install/README.md @@ -1,17 +1,17 @@
-WayOfDev Logo for light theme -WayOfDev Logo for dark theme +WayOfDev Logo for light theme +WayOfDev Logo for dark theme


-Build Status -Software License -Commits since latest release +Build Status +Software License +Commits since latest release Codecov
@@ -51,7 +51,7 @@ jobs: # ... - name: ๐Ÿ“ฅ Install dependencies with Phive - uses: wayofdev/gh-actions/actions/phive/install@master + uses: cycle/gh-actions/actions/phive/install@master with: phive-home: '.build/phive' trust-gpg-keys: '0x033E5F8D801A2F8D' diff --git a/actions/playwright/install/README.md b/actions/playwright/install/README.md deleted file mode 100644 index 7b034f1..0000000 --- a/actions/playwright/install/README.md +++ /dev/null @@ -1,91 +0,0 @@ -
- -
-WayOfDev Logo for light theme -WayOfDev Logo for dark theme -
- - -
-
- -
-Build Status -Software License -Commits since latest release -Codecov - -
- - - -
- -# Playwright / Install - -This GitHub Action installs [Playwright](https://playwright.dev/) along with its dependencies. Playwright is a framework for browser-based automation and testing across multiple browsers. This action supports custom configurations for cache directories and the installation of specific browsers, tailored for efficient testing environments in CI workflows. - -
- -## Example Usage - -Create a new workflow file, for example, `.github/workflows/test.yml`, and add the following code to it. - -```yaml ---- - -on: - push: - branches: - - master - pull_request: - -name: ๐Ÿงช E2E testing for web app - -jobs: - test: - runs-on: ubuntu-latest - - steps: - - name: ๐Ÿ“ฆ Check out the codebase - uses: actions/checkout@v4 - - # ... - - - name: ๐ŸŽญ Install Playwright - uses: wayofdev/gh-actions/actions/playwright/install@master - with: - playwright-cache-folder: '~/.cache/ms-playwright' - cache-prefix: 'ci-tests' - browsers: 'chromium webkit' - - # ... - -... -``` - -For details, see [`actions/playwright/install/action.yml`](https://chat.openai.com/c/action.yml). - -Real-world examples can be found in the [`wayofdev/next-starter-tpl`](https://github.com/wayofdev/next-starter-tpl/blob/master/.github/workflows/e2e-apps-web.yml) repository. - -
- -## Structure - -### Inputs - -- `playwright-cache-folder`, optional: Specifies the directory for caching Playwright installations. Defaults to `~/.cache/ms-playwright`. -- `cache-prefix`, optional: A prefix used to invalidate the cache in case of issues. Defaults to `default`. -- `browsers`, optional: Specifies which browsers to install. Defaults to `"chromium webkit"`. - -### Outputs - -none - -### Side Effects - -- Custom configurations are used to set up the Playwright environment, specifically targeting cache management and browser installation. -- The caching mechanism is optimized with a dynamically generated cache key that considers the OS, Playwright version, browser selection, and any specified cache prefix. -- If the cache does not match the current requirements (e.g., due to a version update or change in selected browsers), Playwright will reinstall the necessary components. - -
diff --git a/actions/playwright/install/action.yml b/actions/playwright/install/action.yml deleted file mode 100644 index ac2b2ab..0000000 --- a/actions/playwright/install/action.yml +++ /dev/null @@ -1,62 +0,0 @@ ---- - -name: ๐ŸŽญ Playwright install -description: 'Installs the playwright with deps' - -inputs: - playwright-cache-folder: - description: 'Set playwright cache folder' - required: false - default: '~/.cache/ms-playwright' - cache-prefix: - description: 'Used to invalidate cache in case of issue' - required: false - default: 'default' - browsers: - description: 'Set browsers to install (ie: "chromium webkit")' - required: false - default: 'chromium webkit' - -runs: - using: 'composite' - steps: - - name: ๐Ÿ“œ Expose playwright config - id: playwright-config - shell: bash - run: | - echo "CURRENT_VERSION=$(pnpm list -r @playwright/test | grep @playwright | sed -n 's/.*@playwright\/test //p' | head -n 1)" >> $GITHUB_OUTPUT - RAW_BROWSERS="${{ inputs.browsers }}" - BROWSERS=$(echo $RAW_BROWSERS | sed -r 's/[[:space:]]+/+/g') - echo "BROWSERS=$BROWSERS" >> $GITHUB_OUTPUT - - - name: ๐Ÿค– Compute cache config - id: playwright-cache-config - shell: bash - run: | - echo "CACHE_KEY=${{ runner.os }}-playwright-cache-${{ inputs.cache-prefix }}-${{ steps.playwright-config.outputs.CURRENT_VERSION }}-${{ steps.playwright-config.outputs.BROWSERS }}" >> $GITHUB_OUTPUT - - - name: ๐Ÿ“ฅ Restore playwright install - uses: actions/cache@v4 - id: playwright-cache - with: - path: ${{ inputs.playwright-cache-folder }} - key: ${{ steps.playwright-cache-config.outputs.CACHE_KEY }} - - - name: ๐Ÿš€ Playwright debug - shell: bash - run: | - echo "OS: ${{ matrix.os }}" - echo "Playwright version: ${{ steps.playwright-version.outputs.version }}" - echo "Playwright cache folder: ${{ inputs.playwright-cache-folder }}" - echo "Browsers: ${{ inputs.browsers }}" - echo "Cache key: ${{ steps.playwright-cache-config.outputs.CACHE_KEY }}" - echo "Cache matched key: ${{ steps.playwright-cache.outputs.cache-matched-key }}" - echo "Cache hit: ${{ steps.playwright-cache.outputs.cache-hit == 'true' }}" - echo "Cache match: ${{ steps.playwright-cache.outputs.cache-matched-key == steps.playwright-cache-config.outputs.CACHE_KEY }}" - - - name: ๐Ÿ“ฆ Install playwright browsers - if: steps.playwright-cache.outputs.cache-matched-key != ${{ steps.playwright-cache-config.outputs.CACHE_KEY }} - shell: bash - run: pnpx playwright install --with-deps ${{ inputs.browsers }} - -... diff --git a/actions/pnpm/install/README.md b/actions/pnpm/install/README.md deleted file mode 100644 index 0c5b576..0000000 --- a/actions/pnpm/install/README.md +++ /dev/null @@ -1,96 +0,0 @@ -
- -
-WayOfDev Logo for light theme -WayOfDev Logo for dark theme -
- - -
-
- -
-Build Status -Software License -Commits since latest release -Codecov - -
- - - -
- -# PNPM / Install - -This GitHub Action installs mono-repository dependencies using [PNPM](https://pnpm.io/). It's designed to efficiently handle dependencies in a mono-repository setup, enabling `corepack` support and caching node modules to speed up builds. - -This action is ideal for projects that require optimal dependency management and fast execution of workflows within CI environments. - -
- -## Example Usage - -Create a new workflow file, for example, `.github/workflows/build.yml`, and add the following code to it. - -```yaml ---- - -on: - push: - branches: - - master - pull_request: - -name: ๐Ÿ” Continuous integration for web app - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: ๐Ÿ“ฆ Check out the codebase - uses: actions/checkout@v4 - - # ... - - - name: โš™๏ธ Setup PNPM mono-repository - uses: wayofdev/gh-actions/actions/pnpm/install@master - with: - cwd: '.' - enable-corepack: true - cache-prefix: 'ci-build' - cache-node-modules: true - - # ... - -... -``` - -For details, see [`actions/pnpm/install/action.yml`](./action.yml). - -Real-world examples can be found in the [`wayofdev/next-starter-tpl`](https://github.com/wayofdev/next-starter-tpl/blob/master/.github/workflows/ci-apps-web.yml) repository. - -
- -## Structure - -### Inputs - -- `cwd`, optional: Changes Node's process current working directory. Defaults to the root directory (`.`). -- `enable-corepack`, optional: Enables `corepack` to manage package installations. Defaults to `false`. -- `cache-prefix`, optional: Specifies a custom prefix for caching mechanisms. Defaults to `default`. -- `cache-node-modules`, optional: Enables caching of `node_modules` directories. Defaults to `false`. - -### Outputs - -none - -### Side Effects - -- Enabling `corepack` sets up the package manager environment using the system's [corepack](https://nodejs.org/api/corepack.html) feature. -- PNPM is installed or configured according to the presence of `corepack`. -- Caching keys are created and used for faster retrieval of the `node_modules` and pnpm store directories. -- Dependencies are installed with options such as `--no-frozen-lockfile`, `--strict-peer-dependencies`, and `--prefer-offline` to ensure consistency and reproducibility across installations. - -
diff --git a/actions/pnpm/install/action.yml b/actions/pnpm/install/action.yml deleted file mode 100644 index 8a4c370..0000000 --- a/actions/pnpm/install/action.yml +++ /dev/null @@ -1,78 +0,0 @@ ---- - -name: โš™๏ธ Monorepo install (pnpm) -description: 'Run pnpm install with enabled cache.' - -inputs: - cwd: - description: "Changes node's process.cwd() if the project is not located on the root. Default to process.cwd()" - required: false - default: '.' - enable-corepack: - description: 'Enable corepack' - required: false - default: 'false' - cache-prefix: - description: "Add a specific cache-prefix" - required: false - default: 'default' - cache-node-modules: - description: 'Cache node_modules, might speed up link step (invalidated lock/os/node-version/branch)' - required: false - default: 'false' - -runs: - using: 'composite' - - steps: - - name: โš™๏ธ Enable Corepack - if: inputs.enable-corepack == 'true' - shell: bash - working-directory: ${{ inputs.cwd }} - run: corepack enable - - - name: โš™๏ธ Install pnpm - if: inputs.enable-corepack == 'false' - uses: pnpm/action-setup@v2 - id: pnpm-install - with: - run_install: false - - - name: ๐ŸŒŽ Expose pnpm config(s) through "$GITHUB_OUTPUT" - id: pnpm-config - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path | tr -d '\n')" >> $GITHUB_OUTPUT - echo "CURRENT_NODE_VERSION="node-$(node --version)"" >> $GITHUB_OUTPUT - echo "CURRENT_BRANCH=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's,/,-,g')" >> $GITHUB_OUTPUT - - - name: โ™ป๏ธ Cache rotation keys - id: cache-rotation - shell: bash - run: | - echo "YEAR_MONTH=$(/bin/date -u "+%Y%m")" >> $GITHUB_OUTPUT - - - name: ๐Ÿ—„๏ธ Setup pnpm cache - uses: actions/cache@v4 - id: pnpm-store-cache - with: - path: ${{ steps.pnpm-config.outputs.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-cache-${{ steps.cache-rotation.outputs.YEAR_MONTH }}-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store-cache-${{ steps.cache-rotation.outputs.YEAR_MONTH }}- - - - name: โ™ป๏ธ Restore node_modules - if: inputs.cache-node-modules == 'true' - id: pnpm-nm-cache - uses: actions/cache@v4 - with: - path: ${{ inputs.cwd }}/**/node_modules - key: pnpm-nm-cache-${{ inputs.cache-prefix }}-${{ runner.os }}-${{ steps.pnpm-config.outputs.CURRENT_NODE_VERSION }}-${{ steps.pnpm-config.outputs.CURRENT_BRANCH }}-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - pnpm-nm-cache-${{ inputs.cache-prefix }}-${{ runner.os }}-${{ steps.pnpm-config.outputs.CURRENT_NODE_VERSION }}-${{ steps.pnpm-config.outputs.CURRENT_BRANCH }}- - - - name: ๐Ÿ“ฆ Install dependencies - shell: bash - run: pnpm install --no-frozen-lockfile --strict-peer-dependencies --prefer-offline - env: - HUSKY: '0' diff --git a/actions/s3/cache/README.md b/actions/s3/cache/README.md deleted file mode 100644 index 006cd3f..0000000 --- a/actions/s3/cache/README.md +++ /dev/null @@ -1,212 +0,0 @@ -
- WayOfDev Logo for light theme - WayOfDev Logo for dark theme -
-

- -
- Build Status - Software License - Commits since latest release - Codecov - -
-
- -# S3 / Cache - -This GitHub Action allows you to save and restore cache artifacts from an S3 bucket. It provides a convenient way to cache dependencies, build artifacts, or any other files that can be reused across multiple workflow runs, helping to speed up your CI/CD pipeline. - -
- -## ๐Ÿ“‹ Features - -- Save cache to an S3 bucket -- Restore cache from an S3 bucket -- Specify custom cache keys and restore keys -- Compress cache files using tar and gzip for efficient storage and transfer - -
- -## ๐Ÿ“ฅ Inputs - -* `cache-action` - - Specify what to do with the cache: save to a s3 bucket or restore from the s3 bucket into `cache_path`. - - - Type: string - - Required - - Possible values: save, restore - -* `cache-path` - - Absolute or relative path to a folder with cache. When `cache-action` is `save` the path itself will not be saved, only the contents of the directory (including all subdirectories). When `cache-action` is `restore` all folders in `cache_path` will be created first and cache will be restored from the S3 bucket into this folder. - - - Type: string - - Required - - Default: . - -* `s3-bucket-name` - - AWS S3 bucket name which will be used to save cache to and restore it from. - - - Type: string - - Required - -* `cache-key` - - A cache key which is used only to save cache to S3 bucket - - - Type: string - - Required only when `cache-action` is `save` - -* `restore-keys` - - An ordered list of keys to use for restoring cache from the s3 bucket - - - Type: list of strings - - Required only when `cache-action` is `restore` - - You can specify multiple keys by putting each key on its own line: - ```yaml - restore-keys: |- - ${{ runner.os }}-cache-${{ hashfiles('**/.package-lock.json') }} - ${{ runner.os }}-cache - ``` - The first matching key will be restored. - -
- -## ๐ŸŒŽ Environment Variables - -The action requires the following environment variables to be set: - -- `AWS_ACCESS_KEY_ID`: The AWS access key ID with permissions to access the S3 bucket. -- `AWS_SECRET_ACCESS_KEY`: The AWS secret access key associated with the access key ID. -- `AWS_REGION`: The AWS region where the S3 bucket is located. - -
- -## โš™๏ธ Usage Examples - -### โ†’ Saving Cache - -```yaml ---- - -name: ๐Ÿ” Continuous integration - -on: # yamllint disable-line rule:truthy - push: - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: ๐Ÿ“ฆ Check out the codebase - uses: actions/checkout@v4 - - - name: ๐Ÿ“ค Save cache - uses: wayofdev/gh-actions/actions/s3/cache@v3.0.0 - with: - cache-action: save - cache-path: ./node_modules - s3-bucket-name: my-cache-bucket - cache-key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }} - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_REGION: ${{ secrets.AWS_REGION }} - -... -``` - -### โ†’ Restoring Cache - -```yaml ---- - -name: ๐Ÿ” Continuous integration - -on: # yamllint disable-line rule:truthy - push: - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: ๐Ÿ“ฆ Check out the codebase - uses: actions/checkout@v4 - - - name: โ™ป๏ธ Restore cache - uses: wayofdev/gh-actions/actions/s3/cache@v3.0.0 - with: - cache-action: restore - cache-path: ${GITHUB_WORKSPACE}/.cache - s3-bucket-name: my_s3_bucket - restore-keys: | - ${{ runner.os }}-cache-${{ hashfiles('**/.package-lock.json') }} - ${{ runner.os }}-cache - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_REGION: ${{ secrets.AWS_REGION }} - -... -``` - -In the restore example, the action will attempt to restore the cache using the provided `restore-keys` in the specified order. If a cache hit occurs for a key, the restoration process will stop, and the cached files will be extracted to the `cache-path`. -### โ†’ Error Handling - -The action will fail if any of the required inputs or environment variables are missing or if an invalid `cache-action` is provided. Appropriate error messages will be logged to help troubleshoot the issue. - -### โ†’ Creating a Cache Key -A cache key can include any of the contexts, functions, literals, and operators supported by GitHub Actions. - -For example, using the `hashFiles` function allows you to create a new cache when dependencies change. The `hashFiles` function is specific to GitHub Actions. - -```yaml -cache-key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} -``` - -Additionally, you can use arbitrary command output in a cache key, such as a date or software version: - - -```yaml ---- - -name: ๐Ÿ” Continuous integration - -on: # yamllint disable-line rule:truthy - push: - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Get current timestamp - id: get-date - run: | - echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT - shell: bash - - - name: ๐Ÿ“ค Save cache - uses: wayofdev/gh-actions/actions/s3-cache@v1 - with: - cache-action: save - cache-path: ${GITHUB_WORKSPACE}/.cache - s3-bucket-name: my_s3_bucket - cache-key: ${{ runner.os }}-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/lockfiles') }} - -... -``` - -See [GitHub Contexts and Expressions](https://docs.github.com/en/actions/learn-github-actions/contexts#github-context) for more cache key examples. - -
- -## โ˜๏ธ Limitations - -This action has not been tested on self-hosted runners or when running inside a container, or other S3 buckets, other than AWS. - -
diff --git a/actions/s3/cache/action.yml b/actions/s3/cache/action.yml deleted file mode 100644 index af72f65..0000000 --- a/actions/s3/cache/action.yml +++ /dev/null @@ -1,38 +0,0 @@ ---- - -name: 'Custom S3 cache' -description: 'Save and restore cache artifacts from AWS s3 bucket' -author: Alina Freydina - -inputs: - cache-action: - description: 'An action to do with cache example: `save` or `restore`' - required: true - cache-path: - description: Absolute or relative path where cache will be restored to, or saved from - required: true - default: . - s3-bucket-name: - description: AWS S3 bucket name to save cache to, or restore cache from - required: true - cache-key: - description: A cache key which used only to save cache to s3 bucket - required: false - restore-keys: - description: 'An ordered list of keys to use for restoring cache from s3 bucket' - required: false - -runs: - using: 'composite' - steps: - - name: Run action script - run: ${{ github.action_path }}/cache.sh - shell: bash - env: - INPUT_CACHE_ACTION: "${{ inputs.cache-action }}" - INPUT_CACHE_PATH: "${{ inputs.cache-path }}" - INPUT_S3_BUCKET_NAME: "${{ inputs.s3-bucket-name }}" - INPUT_CACHE_KEY: "${{ inputs.cache-key }}" - INPUT_RESTORE_KEYS: "${{ inputs.restore-keys }}" - -... diff --git a/actions/s3/cache/cache.sh b/actions/s3/cache/cache.sh deleted file mode 100755 index 2488364..0000000 --- a/actions/s3/cache/cache.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -function save_cache() { - - if [[ $(aws s3 ls s3://"${S3_BUCKET}"/"${CACHE_KEY}"/ --region "$AWS_REGION" | head) ]]; then - echo "Cache is already existed for key: ${CACHE_KEY}" - else - echo "Saving cache for key ${CACHE_KEY}" - - tmp_dir="$(mktemp -d)" - (cd "$CACHE_PATH" && tar czf "${tmp_dir}/archive.tgz" ./*) - local size="$(ls -lh "${tmp_dir}/archive.tgz" | cut -d ' ' -f 5 )" - - aws s3 cp "${tmp_dir}/archive.tgz" "s3://${S3_BUCKET}/${CACHE_KEY}/archive.tgz" --region "$AWS_REGION" > /dev/null - local copy_exit_code=$? - rm -rf "${tmp_dir}" - echo "Cache size: ${size}" - - if [[ "${copy_exit_code}" == 0 ]]; then - echo "Cache saved successfully for key: ${CACHE_KEY}" - fi - fi -} - -function restore_cache() { - - for key in ${RESTORE_KEYS}; do - if [[ $(aws s3 ls s3://"${S3_BUCKET}"/ --region "$AWS_REGION" | grep "$key" | head) ]]; then - local k=$(aws s3 ls s3://"${S3_BUCKET}"/ --region "$AWS_REGION" | grep "$key" | head -n 1 | awk '{print $2}') - tmp_dir="$(mktemp -d)" - mkdir -p "$CACHE_PATH" - - aws s3 cp s3://"${S3_BUCKET}"/"${k//\//}"/archive.tgz "$tmp_dir"/archive.tgz --region "$AWS_REGION" > /dev/null - tar xzf "${tmp_dir}/archive.tgz" -C "$CACHE_PATH" - - echo "Restoring cache for key ${key}" - du -sm "${CACHE_PATH}"/* - exit 0 - else - echo "Cache with key $key not found." - fi - done -} - -# Check if all necessary variables are set - -if [[ -z "$INPUT_CACHE_ACTION" && -z "$INPUT_S3_BUCKET_NAME" ]]; then - echo "::error::Required inputs are missing: cache_action, s3_bucket_name and either cache_key (if cache_action is save) or restore_keys (if cache_action is restore) must be set." - exit 1 - -fi - -if [[ "$INPUT_CACHE_ACTION" != 'save' ]] && [[ "$INPUT_CACHE_ACTION" != 'restore' ]]; then - echo "::error::Incorrect cache_action. Must be 'save' or 'restore'." - exit 1 -fi - -if [[ "$INPUT_CACHE_ACTION" == "save" && -z "$INPUT_CACHE_KEY" ]]; then - echo "::error::Required inputs are missing: cache_action, s3_bucket_name and either cache_key (if cache_action is save) or restore_keys (if cache_action is restore) must be set." - exit 1 -fi - -if [[ "$INPUT_CACHE_ACTION" == "restore" && -z "$INPUT_RESTORE_KEYS" ]]; then - echo "::error::Required inputs are missing: cache_action, s3_bucket_name and either cache_key (if cache_action is save) or restore_keys (if cache_action is restore) must be set." - exit 1 -fi - -if [[ ! -v AWS_ACCESS_KEY_ID || ! -v AWS_SECRET_ACCESS_KEY || ! -v AWS_REGION ]]; then - echo "::error::AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_REGION must be set" - exit 1 -fi - -# Main logic - -if [[ -v INPUT_CACHE_PATH ]]; then - CACHE_PATH=$INPUT_CACHE_PATH -fi -S3_BUCKET=$INPUT_S3_BUCKET_NAME - -if [[ "$INPUT_CACHE_ACTION" == "save" ]]; then - CACHE_KEY=$INPUT_CACHE_KEY - save_cache -else - RESTORE_KEYS=$INPUT_RESTORE_KEYS - restore_cache -fi