Add Date added #531
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test Build | |
| on: | |
| pull_request: | |
| types: | |
| - opened | |
| - synchronize | |
| - reopened | |
| workflow_dispatch: | |
| jobs: | |
| prepare: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| submodule-matrix: ${{ steps.discover-submodules.outputs.submodule-matrix }} | |
| has-submodules: ${{ steps.discover-submodules.outputs.has-submodules }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| repository: ${{ github.event.pull_request.head.repo.full_name }} | |
| ref: ${{ github.event.pull_request.head.ref }} | |
| persist-credentials: false | |
| fetch-depth: 0 | |
| - name: Upload Build Scripts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-scripts | |
| path: scripts/build/ | |
| retention-days: 1 | |
| - name: Determine changed plugins | |
| id: changed-plugins | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| REPO: ${{ github.repository }} | |
| PR_NUMBER: ${{ github.event.pull_request.number }} | |
| run: | | |
| set -euo pipefail | |
| if [[ "${{ github.event_name }}" != "pull_request" ]]; then | |
| echo "Not a pull_request event; building all plugins." | |
| echo "apply-filter=false" >> "$GITHUB_OUTPUT" | |
| echo "changed-plugins=" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| changed=$(gh api "repos/$REPO/pulls/$PR_NUMBER/files" --paginate \ | |
| --jq '.[] | select(.filename | startswith("plugins/")) | .filename' \ | |
| | awk -F/ '{print $1"/"$2}' | sort -u) | |
| echo "Changed plugin paths:" | |
| echo "${changed:-<none>}" | |
| echo "apply-filter=true" >> "$GITHUB_OUTPUT" | |
| { | |
| echo "changed-plugins<<EOF" | |
| echo "$changed" | |
| echo "EOF" | |
| } >> "$GITHUB_OUTPUT" | |
| - name: Discover submodules | |
| id: discover-submodules | |
| env: | |
| APPLY_FILTER: ${{ steps.changed-plugins.outputs.apply-filter }} | |
| CHANGED_PLUGINS: ${{ steps.changed-plugins.outputs.changed-plugins }} | |
| run: | | |
| sudo bash ./scripts/_gen_metadata.sh | |
| sudo -E bash ./scripts/_submodules.sh > submodules.json | |
| cat submodules.json | |
| echo "submodule-matrix=$(cat submodules.json)" >> $GITHUB_OUTPUT | |
| echo "has-submodules=$(jq '(.submodules | length) > 0' submodules.json)" >> $GITHUB_OUTPUT | |
| - name: Commit Metadata | |
| if: github.event_name != 'pull_request' && github.event.repository.fork == false | |
| run: | | |
| git config --global user.name 'github-actions[bot]' | |
| git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
| # Stage the changes | |
| git add metadata.json | |
| # Commit only if there are changes | |
| if git commit -m "chore: Add plugin metadata"; then | |
| # Push only if the commit succeeded | |
| git push | |
| else | |
| echo "::debug::No changes to commit." | |
| fi | |
| make: | |
| needs: prepare | |
| if: needs.prepare.outputs.has-submodules == 'true' | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJson(needs.prepare.outputs.submodule-matrix) }} | |
| name: Build (${{ matrix.submodules.repository }}) | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: ${{ matrix.submodules.repository }} | |
| ref: ${{ matrix.submodules.sha }} | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| fetch-depth: 0 | |
| submodules: recursive | |
| - name: Download Build Scripts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-scripts | |
| path: scripts/build/ | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v2 | |
| with: | |
| node-version: "20" | |
| - name: Install pnpm | |
| run: npm install -g pnpm | |
| - name: Install Dependencies | |
| run: | | |
| pnpm install | |
| env: | |
| NODE_ENV: production | |
| - name: Build Plugin | |
| run: | | |
| pnpm run build | |
| env: | |
| NODE_ENV: production | |
| - name: Prepare Distribution Files | |
| run: bash ./scripts/build/prepare-dist.sh | |
| - name: Upload Plugin | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.PLUGIN_NAME }} | |
| include-hidden-files: true | |
| path: dist/ |