|
| 1 | +name: Publish Site |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main # Set a branch that will trigger a deployment |
| 7 | + pull_request: |
| 8 | + |
| 9 | +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
| 10 | +permissions: |
| 11 | + contents: read |
| 12 | + pages: write |
| 13 | + id-token: write |
| 14 | + |
| 15 | +# Allow one concurrent deployment |
| 16 | +concurrency: |
| 17 | + group: pages |
| 18 | + cancel-in-progress: true |
| 19 | + |
| 20 | +jobs: |
| 21 | + build: |
| 22 | + runs-on: ubuntu-22.04 |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@v3 |
| 25 | + with: |
| 26 | + fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod |
| 27 | + - name: Setup Pages |
| 28 | + uses: actions/configure-pages@v3 |
| 29 | + - name: Setup Hugo |
| 30 | + uses: peaceiris/actions-hugo@v2 |
| 31 | + with: |
| 32 | + hugo-version: latest |
| 33 | + extended: true |
| 34 | + - name: Setup Node |
| 35 | + uses: actions/setup-node@v3 |
| 36 | + with: |
| 37 | + node-version: latest |
| 38 | + cache: npm |
| 39 | + # The action defaults to search for the dependency file (package-lock.json, |
| 40 | + # npm-shrinkwrap.json or yarn.lock) in the repository root, and uses its |
| 41 | + # hash as a part of the cache key. |
| 42 | + # https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#caching-packages-data |
| 43 | + cache-dependency-path: '**/package-lock.json' |
| 44 | + - name: Install PostCSS |
| 45 | + run: | |
| 46 | + cd ./Site |
| 47 | + npm ci |
| 48 | + npm ls |
| 49 | + cd .. |
| 50 | + - name: Setup PowerShell module cache |
| 51 | + id: cacher |
| 52 | + uses: actions/cache@v3 |
| 53 | + with: |
| 54 | + path: '~/.local/share/powershell/Modules' |
| 55 | + key: ${{ runner.os }}-SqlServer-PSScriptAnalyzer |
| 56 | + - name: Install required PowerShell modules |
| 57 | + if: steps.cacher.outputs.cache-hit != 'true' |
| 58 | + shell: pwsh |
| 59 | + run: | |
| 60 | + Set-PSRepository PSGallery -InstallationPolicy Trusted |
| 61 | + Install-Module InvokeBuild, PowerShell-Yaml -ErrorAction Stop |
| 62 | + - name: Build the Site |
| 63 | + shell: pwsh |
| 64 | + env: |
| 65 | + HUGO_ENVIRONMENT: production |
| 66 | + HUGO_ENV: production |
| 67 | + run: | |
| 68 | + Invoke-Build -Task BuildSite -SiteBaseUrl https://powershell.github.io/DSC-Samples/ |
| 69 | + - name: Upload artifact |
| 70 | + uses: actions/upload-pages-artifact@v1 |
| 71 | + with: |
| 72 | + path: ./.site/public |
| 73 | + # Deployment job |
| 74 | + # deploy: |
| 75 | + # if: github.ref == 'refs/heads/main' |
| 76 | + # environment: |
| 77 | + # name: github-pages |
| 78 | + # url: ${{ steps.deployment.outputs.page_url }} |
| 79 | + # runs-on: ubuntu-latest |
| 80 | + # needs: build |
| 81 | + # steps: |
| 82 | + # - name: Deploy to GitHub Pages |
| 83 | + # id: deployment |
| 84 | + # uses: actions/deploy-pages@v2 |
0 commit comments