From 1fea301ecfee012931fb23774efcafec22c56782 Mon Sep 17 00:00:00 2001 From: Cory Sanin Date: Tue, 29 Apr 2025 20:56:09 -0500 Subject: [PATCH] move to gitea --- .../workflows/build-app-image.yml | 40 +------------- .../workflows/build-arch-images.yml | 8 +-- package-lock.json | 52 +++++++++---------- package.json | 6 +-- scripts/build.js | 25 ++++++--- views/build.ejs | 2 +- views/footer.ejs | 2 +- 7 files changed, 53 insertions(+), 82 deletions(-) rename {.github => .gitea}/workflows/build-app-image.yml (51%) rename {.github => .gitea}/workflows/build-arch-images.yml (86%) diff --git a/.github/workflows/build-app-image.yml b/.gitea/workflows/build-app-image.yml similarity index 51% rename from .github/workflows/build-app-image.yml rename to .gitea/workflows/build-app-image.yml index 54e8345..376d74c 100644 --- a/.github/workflows/build-app-image.yml +++ b/.gitea/workflows/build-app-image.yml @@ -17,8 +17,6 @@ jobs: runs-on: ubuntu-latest env: DH_REGISTRY: docker.io - GH_REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} REPOSITORY: ${{ github.event.repository.name }} DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} permissions: @@ -42,60 +40,24 @@ jobs: registry: ${{ env.DH_REGISTRY }} username: ${{ env.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ${{ env.GH_REGISTRY }} - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - name: Extract metadata for release Docker image - if: startsWith(github.ref, 'refs/tags/v') id: meta uses: docker/metadata-action@v5 with: images: | ${{ env.DOCKER_USERNAME }}/${{ env.REPOSITORY }} - ${{ env.GH_REGISTRY }}/${{ env.IMAGE_NAME }} tags: | type=raw,value=latest type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} - - name: Extract metadata for develop Docker image - if: "!startsWith(github.ref, 'refs/tags/v')" - id: meta-develop - uses: docker/metadata-action@v5 - with: - images: | - ${{ env.GH_REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=ref,event=branch - type=ref,event=pr - - name: Build and push release Docker image - if: startsWith(github.ref, 'refs/tags/v') uses: docker/build-push-action@v6 with: target: deploy - push: true + push: startsWith(github.ref, 'refs/tags/v') tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - platforms: linux/amd64 - cache-from: type=gha,scope=${{ github.workflow }} - cache-to: type=gha,mode=max,scope=${{ github.workflow }} - - - name: Build and push develop Docker image - if: "!startsWith(github.ref, 'refs/tags/v')" - uses: docker/build-push-action@v6 - with: - target: deploy - push: true - tags: ${{ steps.meta-develop.outputs.tags }} - labels: ${{ steps.meta-develop.outputs.labels }} - platforms: linux/amd64 - cache-from: type=gha,scope=${{ github.workflow }} - cache-to: type=gha,mode=max,scope=${{ github.workflow }} diff --git a/.github/workflows/build-arch-images.yml b/.gitea/workflows/build-arch-images.yml similarity index 86% rename from .github/workflows/build-arch-images.yml rename to .gitea/workflows/build-arch-images.yml index f86a363..7378e33 100644 --- a/.github/workflows/build-arch-images.yml +++ b/.gitea/workflows/build-arch-images.yml @@ -39,22 +39,22 @@ jobs: run: echo "DEPLOY=true" >> $GITHUB_ENV - name: Checkout repository - uses: actions/checkout@v4 + uses: https://github.com/actions/checkout@v4 - name: Set up Docker Buildx id: buildx - uses: docker/setup-buildx-action@v3 + uses: https://github.com/docker/setup-buildx-action@v3 with: install: true - name: Log in to the Docker Hub - uses: docker/login-action@v3 + uses: https://github.com/docker/login-action@v3 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Build Docker image - uses: docker/build-push-action@v6 + uses: https://github.com/docker/build-push-action@v6 with: push: ${{ env.DEPLOY }} pull: true diff --git a/package-lock.json b/package-lock.json index 3654075..6480aed 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,21 +1,21 @@ { "name": "archery", - "version": "0.1.5", + "version": "0.1.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "archery", - "version": "0.1.5", + "version": "0.1.6", "license": "MIT", "dependencies": { "body-parser": "^1.20.3", "ejs": "3.1.10", "express": "^4.21.2", "express-ws": "^5.0.2", - "pg": "^8.13.1", + "pg": "^8.15.6", "pg-hstore": "^2.3.4", - "sequelize": "^6.37.5" + "sequelize": "^6.37.7" }, "devDependencies": { "@types/csso": "5.0.4", @@ -1459,14 +1459,14 @@ "license": "MIT" }, "node_modules/pg": { - "version": "8.13.1", - "resolved": "https://registry.npmjs.org/pg/-/pg-8.13.1.tgz", - "integrity": "sha512-OUir1A0rPNZlX//c7ksiu7crsGZTKSOXJPgtNiHGIlC9H0lO+NC6ZDYksSgBYY/thSWhnSRBv8w1lieNNGATNQ==", + "version": "8.15.6", + "resolved": "https://registry.npmjs.org/pg/-/pg-8.15.6.tgz", + "integrity": "sha512-yvao7YI3GdmmrslNVsZgx9PfntfWrnXwtR+K/DjI0I/sTKif4Z623um+sjVZ1hk5670B+ODjvHDAckKdjmPTsg==", "license": "MIT", "dependencies": { - "pg-connection-string": "^2.7.0", - "pg-pool": "^3.7.0", - "pg-protocol": "^1.7.0", + "pg-connection-string": "^2.8.5", + "pg-pool": "^3.9.6", + "pg-protocol": "^1.9.5", "pg-types": "^2.1.0", "pgpass": "1.x" }, @@ -1474,7 +1474,7 @@ "node": ">= 8.0.0" }, "optionalDependencies": { - "pg-cloudflare": "^1.1.1" + "pg-cloudflare": "^1.2.5" }, "peerDependencies": { "pg-native": ">=3.0.1" @@ -1486,16 +1486,16 @@ } }, "node_modules/pg-cloudflare": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pg-cloudflare/-/pg-cloudflare-1.1.1.tgz", - "integrity": "sha512-xWPagP/4B6BgFO+EKz3JONXv3YDgvkbVrGw2mTo3D6tVDQRh1e7cqVGvyR3BE+eQgAvx1XhW/iEASj4/jCWl3Q==", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/pg-cloudflare/-/pg-cloudflare-1.2.5.tgz", + "integrity": "sha512-OOX22Vt0vOSRrdoUPKJ8Wi2OpE/o/h9T8X1s4qSkCedbNah9ei2W2765be8iMVxQUsvgT7zIAT2eIa9fs5+vtg==", "license": "MIT", "optional": true }, "node_modules/pg-connection-string": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.7.0.tgz", - "integrity": "sha512-PI2W9mv53rXJQEOb8xNR8lH7Hr+EKa6oJa38zsK0S/ky2er16ios1wLKhZyxzD7jUReiWokc9WK5nxSnC7W1TA==", + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.8.5.tgz", + "integrity": "sha512-Ni8FuZ8yAF+sWZzojvtLE2b03cqjO5jNULcHFfM9ZZ0/JXrgom5pBREbtnAw7oxsxJqHw9Nz/XWORUEL3/IFow==", "license": "MIT" }, "node_modules/pg-hstore": { @@ -1520,18 +1520,18 @@ } }, "node_modules/pg-pool": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.7.0.tgz", - "integrity": "sha512-ZOBQForurqh4zZWjrgSwwAtzJ7QiRX0ovFkZr2klsen3Nm0aoh33Ls0fzfv3imeH/nw/O27cjdz5kzYJfeGp/g==", + "version": "3.9.6", + "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.9.6.tgz", + "integrity": "sha512-rFen0G7adh1YmgvrmE5IPIqbb+IgEzENUm+tzm6MLLDSlPRoZVhzU1WdML9PV2W5GOdRA9qBKURlbt1OsXOsPw==", "license": "MIT", "peerDependencies": { "pg": ">=8.0" } }, "node_modules/pg-protocol": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.7.0.tgz", - "integrity": "sha512-hTK/mE36i8fDDhgDFjy6xNOG+LCorxLG3WO17tku+ij6sVHXh1jQUJ8hYAnRhNla4QVD2H8er/FOjc/+EgC6yQ==", + "version": "1.9.5", + "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.9.5.tgz", + "integrity": "sha512-DYTWtWpfd5FOro3UnAfwvhD8jh59r2ig8bPtc9H8Ds7MscE/9NYruUQWFAOuraRl29jwcT2kyMFQ3MxeaVjUhg==", "license": "MIT" }, "node_modules/pg-types": { @@ -1783,9 +1783,9 @@ "license": "MIT" }, "node_modules/sequelize": { - "version": "6.37.5", - "resolved": "https://registry.npmjs.org/sequelize/-/sequelize-6.37.5.tgz", - "integrity": "sha512-10WA4poUb3XWnUROThqL2Apq9C2NhyV1xHPMZuybNMCucDsbbFuKg51jhmyvvAUyUqCiimwTZamc3AHhMoBr2Q==", + "version": "6.37.7", + "resolved": "https://registry.npmjs.org/sequelize/-/sequelize-6.37.7.tgz", + "integrity": "sha512-mCnh83zuz7kQxxJirtFD7q6Huy6liPanI67BSlbzSYgVNl5eXVdE2CN1FuAeZwG1SNpGsNRCV+bJAVVnykZAFA==", "funding": [ { "type": "opencollective", diff --git a/package.json b/package.json index dddfbd9..8c61286 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "archery", - "version": "0.1.5", + "version": "0.1.6", "description": "Build Arch packages through a web interface", "keywords": [ "docker", @@ -24,9 +24,9 @@ "ejs": "3.1.10", "express": "^4.21.2", "express-ws": "^5.0.2", - "pg": "^8.13.1", + "pg": "^8.15.6", "pg-hstore": "^2.3.4", - "sequelize": "^6.37.5" + "sequelize": "^6.37.7" }, "devDependencies": { "@types/csso": "5.0.4", diff --git a/scripts/build.js b/scripts/build.js index 6540c5c..9ce90a5 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -13,12 +13,14 @@ document.addEventListener('DOMContentLoaded', function () { /** * Add log line to the DOM - * @param {string} str + * @param {string[]} str */ - function appendLine(str, e = false) { - const p = document.createElement('p'); - p.appendChild(document.createTextNode(str)); - logContainer.appendChild(p); + function appendLines(str, e = false) { + str.forEach(line => { + const p = document.createElement('p'); + p.appendChild(document.createTextNode(line)); + logContainer.appendChild(p); + }); } /** @@ -30,6 +32,14 @@ document.addEventListener('DOMContentLoaded', function () { } } + /** + * Split string by newline char + * @param {string} str + */ + function splitLines(str) { + return str.split('\n').map(line => line.substring(line.lastIndexOf('\r') + 1)); + } + /** * Establish websocket connection */ @@ -41,15 +51,14 @@ document.addEventListener('DOMContentLoaded', function () { var ws = new WebSocket(new_uri); ws.onmessage = function (message) { - console.log('Got message: ', message); const buildEvent = JSON.parse(message.data); - + if (buildEvent.type === 'finish') { ws.close(); buildStatusTxt.replaceChild(document.createTextNode(buildEvent.message), buildStatusTxt.firstChild); } else { - appendLine(buildEvent.message, buildEvent.type === 'err'); + appendLines(splitLines(buildEvent.message), buildEvent.type === 'err'); scrollToBottom(); } } diff --git a/views/build.ejs b/views/build.ejs index 62dbf74..4321d37 100644 --- a/views/build.ejs +++ b/views/build.ejs @@ -37,7 +37,7 @@ <%- include("footer", locals) %> <% if (!ended) { %> - + <% } %> diff --git a/views/footer.ejs b/views/footer.ejs index 2fd9794..8a3745b 100644 --- a/views/footer.ejs +++ b/views/footer.ejs @@ -3,7 +3,7 @@ \ No newline at end of file