Skip to content

Update caniuse-lite and browserslist #1125

Update caniuse-lite and browserslist

Update caniuse-lite and browserslist #1125

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
jobs:
test:
name: Test
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout the repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install Node.js & pnpm
uses: pnpm/setup@84cb39b217b10273981911c288cd62326dc7c6d2 # v2.0.2
- name: Install dependencies
run: pnpm ci
- name: Run tests
run: pnpm test
build:
name: Build
runs-on: ubuntu-latest
permissions:
contents: read
if: github.ref == 'refs/heads/main'
needs:
- test
steps:
- name: Checkout the repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install Node.js & pnpm
uses: pnpm/setup@84cb39b217b10273981911c288cd62326dc7c6d2 # v2.0.2
- name: Install dependencies
run: pnpm ci
- name: Install production dependencies
run: pnpm install --prod --ignore-scripts
- name: Build regions
run: pnpm prebuild
- name: Build static files
run: pnpm build
- name: Bundle server with production dependencies
run: pnpm --filter=server --prod deploy --legacy server/dist
- name: Pack build artifacts
run: tar -cf dist.tar client/dist server/dist
- name: Upload build artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: dist
path: dist.tar
retention-days: 1
deploy:
name: Deploy
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
if: github.ref == 'refs/heads/main'
concurrency:
group: deploy
cancel-in-progress: false
needs:
- build
steps:
- name: Checkout the repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Download build artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: dist
- name: Unpack build artifacts
run: tar -xf dist.tar && rm dist.tar
- name: Build Docker image
run: docker build -t ghcr.io/browserslist/browsersl.ist:latest .
- name: Login to GitHub Container Registry
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push Docker image
run: docker push ghcr.io/browserslist/browsersl.ist:latest
- name: Deploy image
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
let token = await core.getIDToken('https://api.cloud.hplush.dev')
let response = await fetch(
'https://api.cloud.hplush.dev/deploy/browsersl.ist',
{ method: 'POST', headers: { authorization: `Bearer ${token}` } }
)
let answer = await response.text()
if (response.ok) core.info(answer)
else core.setFailed(`${response.status} ${response.statusText}: ${answer}`)
- name: Clean previous images
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSIONS="orgs/browserslist/packages/container/browsersl.ist/versions"
IDS=$(gh api --paginate "$VERSIONS?per_page=100" \
| jq -r '.[] | select(.metadata.container.tags == []) | .id')
if [ -n "$IDS" ]; then
for ID in $IDS; do
echo "Deleting version $ID"
gh api -X DELETE "$VERSIONS/$ID" --silent
done
else
echo "No untagged images"
fi
- name: Clean Cloudflare cache
run: |
curl --fail -X POST \
"https://api.cloudflare.com/client/v4/zones/${{ secrets.CLOUDFLARE_ZONE_ID }}/purge_cache" \
-H "Authorization: Bearer ${{ secrets.CLOUDFLARE_API_TOKEN }}" \
-H "Content-Type: application/json" \
--data '{"purge_everything":true}'