diff options
author | Jonathan Janssens <jonathan.janssens@gmail.com> | 2022-08-19 10:17:06 +0300 |
---|---|---|
committer | Jonathan Janssens <jonathan.janssens@gmail.com> | 2022-08-19 10:17:06 +0300 |
commit | c81ca0b175fff7a25c77548c64f51a09cedf3495 (patch) | |
tree | 0ba328eb5223fbb6b9ca4e0bbcbef260f3e07747 | |
parent | 7e1ea26fe7be0eb72baf9b2c103b81646b9e9be9 (diff) |
Add preview actionchore/add-preview-action
-rw-r--r-- | .github/workflows/preview.yml | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml new file mode 100644 index 0000000..ab18557 --- /dev/null +++ b/.github/workflows/preview.yml @@ -0,0 +1,38 @@ +on: + push: + paths: + - develop + +env: + HUGO_PACKAGE_URL: https://github.com/gohugoio/hugo/releases/download/v0.101.0/hugo_0.101.0_Linux-64bit.deb + CLOUDFLARE_PROJECT: hugo-casper3-dev + +jobs: + deploy-preview: + runs-on: ubuntu-latest + steps: + - name: Install Hugo + run: | + wget -q -O hugo.deb ${{ env.HUGO_PACKAGE_URL }} + sudo dpkg -i hugo.deb + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 16 + - name: Install Wrangler + run: npm install -g wrangler + - name: Checkout Demo + uses: actions/checkout@v2 + with: + repository: jonathanjanssens/hugo-casper3-demo + - name: Checkout Theme + uses: actions/checkout@v2 + with: + path: ./themes/casper3-preview + - name: Build + run: hugo -t casper3-preview --baseUrl https://${{ github.run_id }}.${{ env.CLOUDFLARE_PROJECT }}.pages.dev + - name: Deploy + run: wrangler pages publish ./public --branch=${{ github.run_id }} --commit-hash=${{ github.sha }} --project-name=${{ env.CLOUDFLARE_PROJECT }} --commit-dirty=true + env: + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} |