diff --git a/.github/workflows/discourse-sync.yml b/.github/workflows/community-stats.yml similarity index 96% rename from .github/workflows/discourse-sync.yml rename to .github/workflows/community-stats.yml index 554e975e7..76a918080 100644 --- a/.github/workflows/discourse-sync.yml +++ b/.github/workflows/community-stats.yml @@ -5,6 +5,9 @@ on: - cron: '0 */4 * * *' # Every 4 hours workflow_dispatch: +permissions: + contents: write + jobs: update-community: runs-on: ubuntu-latest diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 8c21b81ec..000000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,172 +0,0 @@ -name: Deploy Hugo Site - -on: - push: - branches: - - main - workflow_dispatch: - -permissions: - contents: read - pages: write - id-token: write - -concurrency: - group: pages - cancel-in-progress: false - -jobs: - build: - runs-on: ubuntu-latest - env: - HUGO_VERSION: 0.155.1 - steps: - - name: Install Hugo CLI - run: | - wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \ - && sudo dpkg -i ${{ runner.temp }}/hugo.deb - - - name: Checkout - uses: actions/checkout@v4 - with: - submodules: recursive - fetch-depth: 0 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '18' - - - name: Install Node dependencies - run: | - if [ -f package.json ]; then - npm install - fi - - - name: Create data directory - run: mkdir -p data - - - name: Update community stats - run: | - if [ -f .github/scripts/fetch-discourse-activity.js ]; then - echo "Running Discourse activity script..." - node .github/scripts/fetch-discourse-activity.js || { - echo "Discourse script failed, creating fallback data..." - cat > data/community_stats.json << 'EOF' - { - "activities": [ - { - "message": "PowerShell 7.4.1 released with security updates", - "time": "Last week", - "type": "release", - "color": "bg-green-500" - }, - { - "message": "New Azure PowerShell module available", - "time": "2 weeks ago", - "type": "update", - "color": "bg-blue-500" - }, - { - "message": "Community discussions active on forums", - "time": "3 days ago", - "type": "community", - "color": "bg-purple-500" - }, - { - "message": "PowerShell Gallery security improvements", - "time": "1 month ago", - "type": "security", - "color": "bg-orange-500" - } - ], - "stats": { - "total_topics": 15420, - "total_posts": 85230, - "active_users": 12500, - "topics_this_week": 45 - }, - "last_updated": "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)", - "fallback": true - } - EOF - } - else - echo "No Discourse script found, creating default data..." - cat > data/community_stats.json << 'EOF' - { - "activities": [ - { - "message": "PowerShell community thriving", - "time": "Ongoing", - "type": "community", - "color": "bg-blue-500" - }, - { - "message": "Join our active forums", - "time": "Always", - "type": "invitation", - "color": "bg-green-500" - } - ], - "stats": { - "total_topics": 15000, - "total_posts": 80000, - "active_users": 12000, - "topics_this_week": 40 - }, - "last_updated": "$(date -u +%Y-%m-%dT%H:%M:%S.000Z)", - "fallback": true - } - EOF - fi - - - name: Verify community stats file exists - run: | - if [ -f data/community_stats.json ]; then - echo "Community stats file created successfully" - cat data/community_stats.json - else - echo "Community stats file not found" - exit 1 - fi - - - name: Setup Pages - uses: actions/configure-pages@v5 - - # Regenerate the purged Tailwind CSS and the Font Awesome subset from the - # actual markup before building, so the deployed site is never stale even - # if a PR merged (or a required check was overridden) without the rebuilt - # assets committed. The committed assets/css/*.css + fa-*-subset.woff2 stay - # useful for local `hugo server` previews; this makes production the source - # of truth so a missed `npm run build:*` can't ship a broken icon again. - - name: Regenerate generated assets - run: | - npm run build:css - npm run build:icons - - - name: Build with Hugo - env: - HUGO_ENVIRONMENT: production - HUGO_ENV: production - run: | - hugo \ - --gc \ - --minify \ - --destination public - - - name: Upload Pages artifact - uses: actions/upload-pages-artifact@v3 - with: - path: ./public - - deploy: - needs: build - runs-on: ubuntu-latest - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4