CI #12
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: CI | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| pull_request: | |
| types: [opened, synchronize] | |
| workflow_dispatch: | |
| jobs: | |
| setup: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Cache NPM | |
| uses: actions/cache@v4 | |
| with: | |
| path: .cache/npm | |
| key: ${{ runner.os }}-npm-cache | |
| - name: Install Dependencies | |
| run: npm install --quiet --no-progress --cache=.cache/npm | |
| lint: | |
| runs-on: ubuntu-latest | |
| needs: setup | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Cache NPM | |
| uses: actions/cache@v4 | |
| with: | |
| path: .cache/npm | |
| key: ${{ runner.os }}-npm-cache | |
| - name: Install Dependencies | |
| run: npm install --quiet --no-progress --cache=.cache/npm | |
| - name: Lint | |
| run: node_modules/.bin/gulp lint | |
| bundle-stable: | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/develop' | |
| needs: setup | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Cache NPM | |
| uses: actions/cache@v4 | |
| with: | |
| path: .cache/npm | |
| key: ${{ runner.os }}-npm-cache | |
| - name: Install Dependencies | |
| run: npm install --quiet --no-progress --cache=.cache/npm | |
| - name: Bundle | |
| run: node_modules/.bin/gulp bundle | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ui-bundle | |
| path: build/ui-bundle.zip | |
| bundle-dev: | |
| runs-on: ubuntu-latest | |
| if: github.ref != 'refs/heads/master' && github.ref != 'refs/heads/develop' | |
| needs: setup | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Cache NPM | |
| uses: actions/cache@v4 | |
| with: | |
| path: .cache/npm | |
| key: ${{ runner.os }}-npm-cache | |
| - name: Install Dependencies | |
| run: npm install --quiet --no-progress --cache=.cache/npm | |
| - name: Bundle | |
| run: node_modules/.bin/gulp bundle | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ui-bundle | |
| path: ui-bundle.zip | |
| retention-days: 1 | |
| upload: | |
| name: Create release and upload artifacts | |
| needs: | |
| - bundle-stable | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| - name: Inspect directory after downloading artifacts | |
| run: ls -alFR | |
| - name: Create release and upload artifacts | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| wget -q https://github.com/TheAssassin/pyuploadtool/releases/download/continuous/pyuploadtool-x86_64.AppImage | |
| chmod +x pyuploadtool-x86_64.AppImage | |
| ./pyuploadtool-x86_64.AppImage **/ui-bundle.zip | |
| dispatch-documentation-redeploy: | |
| name: Trigger documentation rebuild | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/develop' | |
| needs: | |
| - upload | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Dispatch rebuild to documentation repo | |
| env: | |
| GH_TOKEN_RAW: ${{ secrets.DOCS_REPO_DISPATCH_TOKEN }} | |
| run: | | |
| export GH_TOKEN="$(printf %s "$GH_TOKEN_RAW" | tr -d '\r\n')" | |
| jq -nc \ | |
| --arg source_repo "$GITHUB_REPOSITORY" \ | |
| --arg source_path "https://github.com/$GITHUB_REPOSITORY/releases/download/continuous/ui-bundle.zip" \ | |
| --arg sha "$GITHUB_SHA" \ | |
| --arg message "${{ github.event.head_commit.message }}" \ | |
| --arg author "${{ github.event.head_commit.author.name }}" \ | |
| --arg changed_files "${{ join(github.event.head_commit.modified, ',') }}" \ | |
| '{event_type:"docs-updated",client_payload:{source_repo:$source_repo,source_path:$source_path,sha:$sha,message:$message,author:$author,changed_files:$changed_files}}' \ | |
| > dispatch-payload.json | |
| gh api repos/9kit-com/documentation/dispatches \ | |
| --method POST \ | |
| --input dispatch-payload.json |