diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 17a6c00..1893ae3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,10 @@ name: CI -on: [ push, pull_request_target ] +on: [push, pull_request_target] + +env: + DOCKER_REGISTRY: switchbladebot/invidget + NODE_VERSION: 18.x jobs: lint: @@ -9,8 +13,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - with: - annotate: true - name: Standard run: npx standard env: @@ -18,31 +20,38 @@ jobs: test: name: Test runs-on: ubuntu-latest + strategy: + matrix: + node-version: [14.x, 16.x, 18.x] steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: 18.x - - name: Install Dependencies - run: npm install - - name: Run Tests - run: npm test - env: - CI: true + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - name: Install Dependencies + run: npm install + - name: Run Tests + run: npm test + env: + CI: true + build: name: Docker runs-on: ubuntu-latest needs: [lint, test] if: github.event_name == 'push' + strategy: + matrix: + node-version: [latest, ${{ github.ref }}] steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Build and publish to registry - uses: docker/build-push-action@master - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - repository: switchbladebot/invidget - tag_with_ref: true + - name: Checkout + uses: actions/checkout@v3 + - name: Build and publish to registry + uses: docker/build-push-action@master + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + repository: ${{ env.DOCKER_REGISTRY }} + tag_with_ref: ${{ matrix.tag }} diff --git a/Dockerfile b/Dockerfile index b6deb8d..5fc1998 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,13 @@ -FROM node:lts-alpine - +# Build Stage +FROM node:lts-alpine as build WORKDIR /usr/src/app - COPY package*.json ./ - RUN npm install COPY . . +# Production Stage +FROM node:lts-alpine +WORKDIR /usr/src/app +COPY --from=build /usr/src/app /usr/src/app EXPOSE 80 - -CMD [ "node", "src/index.js" ] \ No newline at end of file +CMD [ "node", "src/index.js" ] diff --git a/LICENSE b/LICENSE index 3c85d08..57c7242 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 Switchblade +Copyright (c) 2023 Switchblade Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/package.json b/package.json index 0287767..e5d0c47 100644 --- a/package.json +++ b/package.json @@ -1,16 +1,19 @@ { "name": "invidget", - "version": "1.0.0", + "version": "1.1.0", "description": "SVG invite widgets that look just like the ones on the Discord client!", "main": "src/index.js", + "engines": { + "node": ">=12" + }, "dependencies": { "@sentry/node": "^6.13.2", "@svgdotjs/svg.js": "^3.1.1", "dd-trace": "^1.4.1", "express": "^4.17.1", "morgan": "^1.10.0", - "node-fetch": "^2.6.0", - "sharp": "^0.29.1", + "node-fetch": "^2.6.12", + "sharp": "^0.32.4", "svgdom": "^0.1.8", "text-to-svg": "^3.1.5", "winston": "^3.10.0" @@ -33,6 +36,11 @@ "type": "git", "url": "git+https://github.com/SwitchbladeBot/invidget.git" }, + "cpu": [ + "x64", + "ia32", + "arm" + ], "standard": { "env": [ "jest"