Skip to content

Commit

Permalink
Preview builds using cloudflare pages
Browse files Browse the repository at this point in the history
  • Loading branch information
vycius committed Feb 9, 2024
1 parent 2e0009f commit 84caf82
Showing 1 changed file with 40 additions and 5 deletions.
45 changes: 40 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@ name: Continuous integration

on:
push:
branches: [main]
branches: [ main ]
pull_request:

jobs:
build-test:
name: Build and test
runs-on: ubuntu-latest
timeout-minutes: 15

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: yarn
Expand All @@ -28,15 +27,51 @@ jobs:

- name: Build
run: yarn run build
env:
NODE_ENV: development
VITE_SENTRY_DSN: https://0385edf7f78f4ad4a511abae516ae3e8@sentry.biip.lt/7
VITE_MAPS_HOST: https://dev.maps.biip.lt

- uses: actions/upload-artifact@v4
with:
name: page
path: dist

validate-docker-build:
name: Validate if docker image builds
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Build & tag docker image
uses: AplinkosMinisterija/reusable-workflows/.github/actions/docker-build-tag-push@main
with:
environment: test
push: false

publish-preview:
name: Publish preview
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
timeout-minutes: 10
needs: build-test
permissions:
contents: read
pages: write
deployments: write
pull-requests: write
steps:
- uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with:
name: page
path: dist

- name: Publish preview to Cloudflare pages
uses: AplinkosMinisterija/reusable-workflows/.github/actions/cloudflare-pages-publish@main
with:
cloudflare-api-token: ${{ secrets.BIIP_CLOUDFLARE_PAGES_API_TOKEN }}
cloudflare-account-id: ${{ secrets.BIIP_CLOUDFLARE_ACCOUNT_ID }}
cloudflare-project-name: biip-zuvinimas-web
directory: dist

0 comments on commit 84caf82

Please sign in to comment.