Preview builds using cloudflare pages #158
Workflow file for this run
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: Continuous integration | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
jobs: | |
build-test: | |
name: Build and test | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: package.json | |
cache: yarn | |
- name: Install dependencies | |
run: yarn install --immutable --immutable-cache --check-cache | |
- name: Run tests | |
run: yarn test --passWithNoTests | |
- name: Build | |
run: yarn run build --mode development | |
env: | |
NODE_ENV: development | |
VITE_MAPS_HOST: https://dev.maps.biip.lt | |
VITE_ZUVINIMAS_API_BASE_URL: https://dev.zuvinimas.biip.lt/api | |
- 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@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 | |
deployments: write | |
steps: | |
- uses: actions/checkout@v4 | |
- 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 | |
artifact-name: page |