| name: build |
| |
| on: |
| push: |
| branches: |
| - main-staging |
| - main |
| |
| env: |
| PUBLISH_DIRECTORY: public |
| |
| permissions: |
| contents: write |
| |
| jobs: |
| build: |
| runs-on: ubuntu-latest |
| steps: |
| - name: Checkout Sources |
| uses: actions/checkout@v3 |
| - name: Checkout Staging |
| if: github.ref_name == 'main-staging' |
| uses: actions/checkout@v3 |
| with: |
| ref: asf-staging |
| path: ${{ env.PUBLISH_DIRECTORY }} |
| - name: Checkout Production |
| if: github.ref_name == 'main' |
| uses: actions/checkout@v3 |
| with: |
| ref: asf-site |
| path: ${{ env.PUBLISH_DIRECTORY }} |
| - name: Install Hugo |
| run: | |
| sudo apt-get update |
| sudo apt-get install hugo |
| - name: Prepare |
| working-directory: ${{ env.PUBLISH_DIRECTORY }} |
| run: | |
| rm -rf stylesheets |
| - name: Build |
| run: | |
| hugo |
| - name: Publish |
| working-directory: ${{ env.PUBLISH_DIRECTORY }} |
| run: | |
| git config user.name "github-actions[bot]" |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| git add . |
| git commit -m "Published changes from $GITHUB_SHA" |
| git push |