From a033f712a1592e9e796a207968317d94ccf3cb1d Mon Sep 17 00:00:00 2001 From: Niccolo Borgioli Date: Wed, 31 Jul 2024 21:10:01 +0200 Subject: [PATCH] use bun --- .github/workflows/cron.yml | 22 +++++++-------- Dockerfile | 7 ++--- tags/README.md | 15 ++++++++++ tags/bun.lockb | Bin 0 -> 6336 bytes tags/{index.js => index.ts} | 11 ++++++-- tags/package.json | 14 ++++++++-- tags/pnpm-lock.yaml | 53 ------------------------------------ tags/tsconfig.json | 18 ++++++++++++ 8 files changed, 65 insertions(+), 75 deletions(-) create mode 100644 tags/README.md create mode 100755 tags/bun.lockb rename tags/{index.js => index.ts} (84%) delete mode 100644 tags/pnpm-lock.yaml create mode 100644 tags/tsconfig.json diff --git a/.github/workflows/cron.yml b/.github/workflows/cron.yml index 6c1ea9b..8205de3 100644 --- a/.github/workflows/cron.yml +++ b/.github/workflows/cron.yml @@ -3,7 +3,7 @@ name: Matrix Cron Build on: workflow_dispatch: schedule: - - cron: "0 3 * * 1" + - cron: '0 3 * * 1' jobs: tags: @@ -14,13 +14,11 @@ jobs: run: working-directory: tags steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - - run: npm i + - uses: actions/checkout@v4 + - uses: oven-sh/setup-bun@v2 + - run: bun i - id: fetcher - run: node . + run: bun . build: runs-on: ubuntu-latest @@ -28,7 +26,7 @@ jobs: strategy: matrix: ${{fromJson(needs.tags.outputs.matrix)}} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up QEMU uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx @@ -37,12 +35,12 @@ jobs: install: true - name: Log in to Docker Hub - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Log in to the Container registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} @@ -50,7 +48,7 @@ jobs: - name: Docker Labels id: meta - uses: docker/metadata-action@v4 + uses: docker/metadata-action@v5 with: images: | cupcakearmy/static @@ -59,7 +57,7 @@ jobs: - name: Build and push id: docker_build - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v6 with: push: true platforms: linux/amd64,linux/arm64 diff --git a/Dockerfile b/Dockerfile index 81def95..dee960a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,11 @@ # BUILDER -FROM alpine AS builder +FROM alpine:3 AS builder -ARG DEP_DEV="alpine-sdk zlib-dev pcre-dev openssl-dev gd-dev" +ARG DEP_DEV="alpine-sdk zlib-dev pcre-dev openssl-dev gd-dev curl" RUN apk add --no-cache ${DEP_DEV} - WORKDIR /build -ARG NGINX=1.21.6 +ARG NGINX RUN curl https://nginx.org/download/nginx-${NGINX}.tar.gz | tar xz RUN mv nginx-${NGINX} nginx RUN git clone --recursive https://github.com/google/ngx_brotli.git diff --git a/tags/README.md b/tags/README.md new file mode 100644 index 0000000..88c3c94 --- /dev/null +++ b/tags/README.md @@ -0,0 +1,15 @@ +# tags + +To install dependencies: + +```bash +bun install +``` + +To run: + +```bash +bun run index.js +``` + +This project was created using `bun init` in bun v1.1.20. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime. diff --git a/tags/bun.lockb b/tags/bun.lockb new file mode 100755 index 0000000000000000000000000000000000000000..fb23316c6529be0234ddde0f5741a005d416e4bc GIT binary patch literal 6336 zcmeHL30PBC7Jk8~$mWJRbwyNEATJABR6qoAsVImGiV8wV@L@%W7MBrmW5Bv0?kh-VRJ0bCQPJsQdrtB$KBtPKmEJBgL1h7tK&h6^R4_`pK%v&eM(6~3k%bvWQGVfD^ji$I!^0mk zp%tzHWu5((?4NhSebJ#9+pddTBfE?K1d~A8m>SCb-`Z5RA4DdweTve`WA$=)LnP{EW`yVz>R`bFxMMl2M|$&t`uYeP(gH2lko5 z&}9yLyau#VdzODYHn+IoRE}Y7%z4J<_KVORC;8H~eNvsB7RV!EIscKMS5U^l1ACX+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tpf9%f$-@kC~ta(-Y znxf$gAA~>2KH2uXq5QZg_zZtvE4v>)$qUzX$-Z`_<)VK9@7n}(8@Z1Ufp@%*ziS@3 zr&l&I?`_!s$KOZ}CGBrn!#lS8w^03o`C|uucRP^7UM#nVf9#_ufVY*g>V@~1XI588z|#FM)^>P3C1m;676 zI*}Xop$(`T+g+@VASg>{!_# z6$W!&n1mM5@J}JBjgT6JxtTITC)es;S5HV4!@S{I3xvkJPwF9Nyf85>7SZB{F9WHV zz=#L!PP@FW)sUJAjGzT#iXvYLQdNNwDeXc_D2mi^NIeBcM1XMz3|sLbl@}Osqb0ah zQUfBj7*>ynqDb|JRAJ0`U^FfEpeR!RA$1rt-W)0Hn^;7VN)f5pz=#Blme5jCJ0dk4 z7y%31!Gd379MO3o>sUY5H29Mn|E8}h?LSK=*Qg?t<8&HE742;&e(h@Mo35sGTA7je z$Pcz(XtFbGu~3J z1vx4*M7o&*K>KKIqc3T^%HZ)?o&zm!W%me`gF!~!ez;ylqV|o!758rz* zZ#W;ICRc(7-Dqjkpb$YuGgat4NFHD#R-KLE)yPU4=CEMnd?SU}136g361D7$N*yI{ zgpM-{2ywE&bn?YU53nwIpHbXtK*Q~#JKbSd8h1g1)qqaaLi9melDrr5tHTNChJy;O lhsR%5;}<%mYM!njD|u?L#h9asP)T;wrjk>B6nUjTwO!RY`1 literal 0 HcmV?d00001 diff --git a/tags/index.js b/tags/index.ts similarity index 84% rename from tags/index.js rename to tags/index.ts index 5dcd2be..61369bf 100644 --- a/tags/index.js +++ b/tags/index.ts @@ -1,4 +1,4 @@ -import { info, setOutput } from '@actions/core' +import { info, setOutput, error } from '@actions/core' import semver from 'semver' // Fetch the current versions from the download page @@ -9,8 +9,13 @@ const html = await fetch(URL).then((r) => r.text()) const re = /"\/download\/nginx-(\d+\.){3}tar\.gz"/g const matches = html.match(re) +if (!matches) { + error(`No versions found at ${URL}`) + process.exit(1) +} + // Clean up the matches to semver format -function clean(match) { +function clean(match: string): string { return match.replace(/"/g, '').replace('/download/nginx-', '').replace('.tar.gz', '') } const versions = matches.map(clean) @@ -19,7 +24,7 @@ const versions = matches.map(clean) // Get the two most up to date versions, mainline and stable const filtered = versions.sort(semver.rcompare).slice(0, 2) -function convert(version, additional = []) { +function convert(version: string, additional: string[] = []) { return { version, // https://github.com/docker/metadata-action#typeraw diff --git a/tags/package.json b/tags/package.json index 3dd15c5..be209ec 100644 --- a/tags/package.json +++ b/tags/package.json @@ -1,8 +1,16 @@ { "type": "module", - "main": "index.js", + "main": "index.ts", + "dependencies": { + "@actions/core": "^1.10.1", + "semver": "^7.6.3" + }, "devDependencies": { - "@actions/core": "^1.10.0", - "semver": "^7.3.8" + "@tsconfig/strictest": "^2.0.5", + "@types/bun": "latest", + "@types/semver": "^7.5.8" + }, + "peerDependencies": { + "typescript": "^5.5.4" } } diff --git a/tags/pnpm-lock.yaml b/tags/pnpm-lock.yaml deleted file mode 100644 index 11c8448..0000000 --- a/tags/pnpm-lock.yaml +++ /dev/null @@ -1,53 +0,0 @@ -lockfileVersion: 5.4 - -specifiers: - '@actions/core': ^1.10.0 - semver: ^7.3.8 - -devDependencies: - '@actions/core': 1.10.0 - semver: 7.3.8 - -packages: - - /@actions/core/1.10.0: - resolution: {integrity: sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==} - dependencies: - '@actions/http-client': 2.0.1 - uuid: 8.3.2 - dev: true - - /@actions/http-client/2.0.1: - resolution: {integrity: sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==} - dependencies: - tunnel: 0.0.6 - dev: true - - /lru-cache/6.0.0: - resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==} - engines: {node: '>=10'} - dependencies: - yallist: 4.0.0 - dev: true - - /semver/7.3.8: - resolution: {integrity: sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==} - engines: {node: '>=10'} - hasBin: true - dependencies: - lru-cache: 6.0.0 - dev: true - - /tunnel/0.0.6: - resolution: {integrity: sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==} - engines: {node: '>=0.6.11 <=0.7.0 || >=0.7.3'} - dev: true - - /uuid/8.3.2: - resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==} - hasBin: true - dev: true - - /yallist/4.0.0: - resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} - dev: true diff --git a/tags/tsconfig.json b/tags/tsconfig.json new file mode 100644 index 0000000..883db7d --- /dev/null +++ b/tags/tsconfig.json @@ -0,0 +1,18 @@ +{ + "extends": "@tsconfig/strictest", + "compilerOptions": { + // Enable latest features + "lib": ["ESNext", "DOM"], + "target": "ESNext", + "module": "ESNext", + "moduleDetection": "force", + "jsx": "react-jsx", + "allowJs": true, + + // Bundler mode + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "noEmit": true + } +}