chore: Update packages (#137) #2
This file contains 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: Deploy website | |
on: | |
push: | |
branches: ["main"] | |
concurrency: | |
group: ${{ github.ref }} | |
jobs: | |
deploy: | |
name: Cloudflare Pages | |
runs-on: ubuntu-latest | |
environment: | |
name: website | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
cache: "npm" | |
- name: Define tag | |
id: tag | |
run: echo "version=$(date +'%Y.%m.%d')-${{ github.run_number }}" >> $GITHUB_OUTPUT | |
- name: Replace cache markers | |
uses: jacobtomlinson/gha-find-replace@v3 | |
with: | |
find: "YYYY.MM.DD" | |
replace: "${{ steps.tag.outputs.version }}" | |
regex: false | |
- name: Update configs | |
shell: pwsh | |
working-directory: src | |
run: | | |
(Get-Content index.html).Replace("__GaTag__", "G-D7NC4KR9YR") | Set-Content index.html | |
Write-Host "... Done!" | |
- name: Install packages | |
run: npm install | |
- name: Build site (production) | |
if: github.ref == 'refs/heads/main' | |
run: npm run build.prod | |
- name: Build site (preview) | |
if: github.ref != 'refs/heads/main' | |
run: npm run build | |
- name: Publish to Cloudflare Pages | |
uses: cloudflare/pages-action@v1 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_KEY }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
projectName: ${{ vars.CLOUDFLARE_PROJECT_NAME }} | |
gitHubToken: ${{ secrets.GITHUB_TOKEN }} | |
directory: dist/app/browser | |
wranglerVersion: "latest" | |
- name: Tag and release note | |
uses: ncipollo/release-action@v1 | |
if: github.ref == 'refs/heads/main' | |
with: | |
generateReleaseNotes: true | |
draft: true | |
tag: ${{ steps.tag.outputs.version }} | |
commit: ${{ github.ref_name }} |