mirror of
https://github.com/thiloho/archtika.git
synced 2025-11-22 02:41:35 +01:00
Use GitHub environments for deploy action
This commit is contained in:
16
.github/workflows/deploy.yml
vendored
16
.github/workflows/deploy.yml
vendored
@@ -5,15 +5,13 @@ on:
|
|||||||
workflows: [ 'Playwright tests' ]
|
workflows: [ 'Playwright tests' ]
|
||||||
types: [ completed ]
|
types: [ completed ]
|
||||||
branches: [ devel, main ]
|
branches: [ devel, main ]
|
||||||
env:
|
|
||||||
SERVER_USER: root
|
|
||||||
QS_SERVER_IP: 128.140.75.240
|
|
||||||
PROD_SERVER_IP: 116.203.122.75
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' }}
|
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' }}
|
||||||
|
environment: ${{ github.event.workflow_run.head_branch == 'devel' && 'qs' || 'prod' }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
@@ -27,14 +25,14 @@ jobs:
|
|||||||
- name: Install SSH Key
|
- name: Install SSH Key
|
||||||
uses: shimataro/ssh-key-action@v2
|
uses: shimataro/ssh-key-action@v2
|
||||||
with:
|
with:
|
||||||
key: ${{ github.event.workflow_run.head_branch == 'devel' && secrets.QS_SSH_KEY || secrets.PROD_SSH_KEY }}
|
key: ${{ secrets.SSH_KEY }}
|
||||||
known_hosts: ${{ github.event.workflow_run.head_branch == 'devel' && secrets.QS_KNOWN_HOSTS || secrets.PROD_KNOWN_HOSTS }}
|
known_hosts: ${{ vars.KNOWN_HOSTS }}
|
||||||
|
|
||||||
- name: Deploy to demo server
|
- name: Deploy to demo server
|
||||||
run: |
|
run: |
|
||||||
nix run nixpkgs#nixos-rebuild -- switch \
|
nix run nixpkgs#nixos-rebuild -- switch \
|
||||||
--flake .#${{ github.event.workflow_run.head_branch == 'devel' && 'qs' || 'prod' }} \
|
--flake .#${{ vars.FLAKE_CONFIGURATION_NAME }} \
|
||||||
--fast \
|
--fast \
|
||||||
--build-host ${{ env.SERVER_USER }}@${{ github.event.workflow_run.head_branch == 'devel' && env.QS_SERVER_IP || env.PROD_SERVER_IP }} \
|
--build-host ${{ vars.SERVER_DEPLOY_USER }}@${{ vars.PUBLIC_SERVER_IP }} \
|
||||||
--target-host ${{ env.SERVER_USER }}@${{ github.event.workflow_run.head_branch == 'devel' && env.QS_SERVER_IP || env.PROD_SERVER_IP }} \
|
--target-host ${{ vars.SERVER_DEPLOY_USER }}@${{ vars.PUBLIC_SERVER_IP }} \
|
||||||
--use-remote-sudo
|
--use-remote-sudo
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{#each data.usersWithWebsites as { id, created_at, username, max_number_websites, website }}
|
{#each data.usersWithWebsites as { id, created_at, username, max_number_websites, website } (id)}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<DateTime date={created_at} />
|
<DateTime date={created_at} />
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
|
|
||||||
{#if website.length > 0}
|
{#if website.length > 0}
|
||||||
<h4>Websites</h4>
|
<h4>Websites</h4>
|
||||||
{#each website as { id, title, max_storage_size }}
|
{#each website as { id, title, max_storage_size } (id)}
|
||||||
<details>
|
<details>
|
||||||
<summary>{title}</summary>
|
<summary>{title}</summary>
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -56,7 +56,7 @@
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<ul class="unpadded">
|
<ul class="unpadded">
|
||||||
{#each data.categories as { id, website_id, user_id, category_name, category_weight } (`${website_id}-${id}`)}
|
{#each data.categories as { id, user_id, category_name, category_weight } (id)}
|
||||||
<li class="category-card">
|
<li class="category-card">
|
||||||
<p>
|
<p>
|
||||||
<strong>{category_name} ({category_weight})</strong>
|
<strong>{category_name} ({category_weight})</strong>
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<ul class="unpadded">
|
<ul class="unpadded">
|
||||||
{#each data.collaborators as { website_id, user_id, permission_level, user } (`${website_id}-${user_id}`)}
|
{#each data.collaborators as { user_id, permission_level, user } (user_id)}
|
||||||
<li class="collaborator-card">
|
<li class="collaborator-card">
|
||||||
<p>
|
<p>
|
||||||
<strong>{user?.username} ({permission_level})</strong>
|
<strong>{user?.username} ({permission_level})</strong>
|
||||||
|
|||||||
@@ -111,7 +111,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{#each data.changeLog as { id, table_name, operation, tstamp, old_value, new_value, user_id, username }}
|
{#each data.changeLog as { id, table_name, operation, tstamp, old_value, new_value, user_id, username } (id)}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<span style:text-decoration={user_id ? "" : "line-through"}>
|
<span style:text-decoration={user_id ? "" : "line-through"}>
|
||||||
|
|||||||
@@ -1,21 +1,25 @@
|
|||||||
import { test } from "@playwright/test";
|
import { test, expect } from "@playwright/test";
|
||||||
import { password, authenticate, userOwner } from "./shared";
|
import { password, authenticate, userOwner } from "./shared";
|
||||||
|
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
await authenticate(userOwner, page);
|
await authenticate(userOwner, page);
|
||||||
});
|
});
|
||||||
|
|
||||||
/* test("Delete all regular users", async ({ page }) => {
|
test("Delete all regular users", async ({ page }) => {
|
||||||
await page.getByRole("link", { name: "Manage" }).click();
|
await page.getByRole("link", { name: "Manage" }).click();
|
||||||
|
|
||||||
await page.waitForSelector("tbody");
|
await page.waitForSelector("tbody");
|
||||||
const userRows = await page.locator("tbody > tr").filter({ hasNotText: userOwner }).all();
|
const userRows = page.locator("tbody > tr").filter({ hasNotText: userOwner });
|
||||||
|
|
||||||
for (const row of userRows) {
|
while ((await userRows.count()) > 0) {
|
||||||
await row.getByRole("button", { name: "Manage" }).click();
|
const currentCount = await userRows.count();
|
||||||
|
|
||||||
|
await userRows.first().getByRole("button", { name: "Manage" }).click();
|
||||||
const modalName = page.url().split("#")[1];
|
const modalName = page.url().split("#")[1];
|
||||||
await page.locator(`#${modalName}`).locator('summary:has-text("Delete")').click();
|
await page.locator(`#${modalName}`).locator('summary:has-text("Delete")').click();
|
||||||
await page.locator(`#${modalName}`).getByRole("button", { name: "Delete user" }).click();
|
await page.locator(`#${modalName}`).getByRole("button", { name: "Delete user" }).click();
|
||||||
|
|
||||||
|
await expect(userRows).toHaveCount(currentCount - 1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -28,4 +32,4 @@ test("Delete admin account", async ({ page }) => {
|
|||||||
.locator("#delete-account-modal")
|
.locator("#delete-account-modal")
|
||||||
.getByRole("button", { name: "Delete account" })
|
.getByRole("button", { name: "Delete account" })
|
||||||
.click();
|
.click();
|
||||||
}); */
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user