From 10d887c4bcc2c940325914fa217573892b38f63e Mon Sep 17 00:00:00 2001 From: withanage Date: Thu, 30 May 2024 23:47:20 +0200 Subject: [PATCH 1/2] Github actions --- .github/workflows/main.yml | 65 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..37f8397b --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,65 @@ +on: + push: + branches: + - '*' + pull_request: + branches: + ['main'] +env: + XML_SCHEMA: "plugins.xsd" + +name: plugin-gallery +jobs: + plugin-gallery: + runs-on: ubuntu-latest + steps: + - uses: actions/setup-node@v4 + with: + node-version: 18 + + - name: "install Dependencies" + run: | + sudo apt-get update -qq + sudo apt-get install libxml2-utils + npm install -g pkp-plugin-cli + shell: bash + + - name: Install for push + if: ${{ github.event_name == 'push'}} + run: | + git clone -b ${{ github.head_ref || github.ref_name }} https://github.com/${{ github.repository}} ~/${{ github.event.repository.name }} --depth 5 + shell: bash + + - name: Install for pull_request + if: ${{github.event_name == 'pull_request'}} + run: | + git clone -b ${{ github.event.pull_request.head.ref}} ${{ github.event.pull_request.head.repo.html_url}} ~/${{ github.event.pull_request.head.repo.name }} --depth 5 + shell: bash + + - name: "Run plugin validation" + run: | + cd ~/${{github.event.pull_request.head.repo.name || github.event.repository.name }} + xmllint --schema ./plugins.xsd ./plugins.xml --noout + shell: bash + + - name: For push + if: ${{ github.event_name == 'push' && github.head_ref == 'main'}} + run: | + cd ~/${{github.event.pull_request.head.repo.name || github.event.repository.name }} + pkp-plugin validate-all-releases --input ./plugins.xml + shell: bash + + - name: For pull request + if: ${{ github.event_name == 'pull_request'}} + run: | + cd ~/${{github.event.pull_request.head.repo.name || github.event.repository.name }} + pwd + pkp-plugin validate-new-release + shell: bash + + - name: For push + if: ${{ github.event_name == 'push' && github.head_ref == 'main'}} + run: | + cd ~/${{github.event.pull_request.head.repo.name || github.event.repository.name }} + GITHUB_TOKEN=${{secrets.GITHUB_TOKEN}} pkp-plugin generate-site $TRAVIS_BUILD_DIR/plugins.xml + shell: bash \ No newline at end of file From 65e76ba3794fbf8a2ac70292d5539754f89acc96 Mon Sep 17 00:00:00 2001 From: withanage Date: Thu, 30 May 2024 23:49:46 +0200 Subject: [PATCH 2/2] Github actions --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 37f8397b..d3861e89 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -61,5 +61,5 @@ jobs: if: ${{ github.event_name == 'push' && github.head_ref == 'main'}} run: | cd ~/${{github.event.pull_request.head.repo.name || github.event.repository.name }} - GITHUB_TOKEN=${{secrets.GITHUB_TOKEN}} pkp-plugin generate-site $TRAVIS_BUILD_DIR/plugins.xml + GITHUB_TOKEN=${{secrets.GITHUB_TOKEN}} pkp-plugin generate-site ./plugins.xml shell: bash \ No newline at end of file