From d4f330544510a054ba18dd75a75503c901cbd974 Mon Sep 17 00:00:00 2001 From: xxsimoxx Date: Tue, 3 Dec 2024 14:15:04 +0100 Subject: [PATCH] Add workflow --- .github/workflows/add-zip-to-release.yml | 30 +++++++++++++++++++++ .github/workflows/cpcs.yml | 34 ++++++++++++++++++++++++ .gitignore | 1 + 3 files changed, 65 insertions(+) create mode 100644 .github/workflows/add-zip-to-release.yml create mode 100644 .github/workflows/cpcs.yml create mode 100644 .gitignore diff --git a/.github/workflows/add-zip-to-release.yml b/.github/workflows/add-zip-to-release.yml new file mode 100644 index 0000000..a8dd9b4 --- /dev/null +++ b/.github/workflows/add-zip-to-release.yml @@ -0,0 +1,30 @@ +name: Generate Installable Plugin or Theme, and Upload as Release Asset +on: + release: + types: [published] +jobs: + build: + name: Upload Release Asset + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: setup git config + run: | + git config user.name "GitHub Actions Bot" + git config user.email "<>" + - name: Create artifact + run : | + git archive -o ${{ github.event.repository.name }}-${{ github.ref_name }}.zip --prefix ${{ github.event.repository.name }}/ HEAD + ls + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ github.event.repository.name }}-${{ github.ref_name }} + path: ${{ github.event.repository.name }}-${{ github.ref_name }}.zip + - name: Upload to release + uses: JasonEtco/upload-to-release@master + with: + args: ${{ github.event.repository.name }}-${{ github.ref_name }}.zip application/zip + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/cpcs.yml b/.github/workflows/cpcs.yml new file mode 100644 index 0000000..3edf31e --- /dev/null +++ b/.github/workflows/cpcs.yml @@ -0,0 +1,34 @@ +name: ClassicPress Directory Coding Standard checks. + +on: [pull_request, push] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + phpcs: + name: CPCS + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: CPCS get rules + run: | + wget -O phpcs.xml https://raw.githubusercontent.com/ClassicPress/ClassicPress-Coding-Standards/main/phpcs.xml + sed -i '/^\t.*/a\ + . + ' phpcs.xml + sed -i '/MY_DOMAIN/ s//codepotent-registration-honeypot/' phpcs.xml + mv phpcs.xml phpcs.xml.dist + - name: CPCS checks + uses: 10up/wpcs-action@stable + with: + use_local_config: 'true' + enable_warnings: 'true' + extra_args: '--report-json=./phpcs.json' + - name: Update summary + run: | + npm i -g github:10up/phpcs-json-to-md + phpcs-json-to-md --path ./phpcs.json --output ./phpcs.md + cat phpcs.md >> $GITHUB_STEP_SUMMARY + if: always() diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..496ee2c --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store \ No newline at end of file