Skip to content

Commit

Permalink
Merge branch 'develop' into prototype/author-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesbiggs committed Aug 15, 2023
2 parents de74dc8 + 2339457 commit 1b9a0f1
Show file tree
Hide file tree
Showing 21 changed files with 441 additions and 223 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/branch-cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Clean up feature branch

on:
delete:
branches:
- feature/*

env:
IMAGE_NAME: ds-wagtail

jobs:
delete:
if: github.event.ref_type == 'branch'
runs-on: ubuntu-latest
steps:
- name: Clean up
run: |
IMAGE_ID=$IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "main" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
echo "IMAGE_ID=$IMAGE_ID" >> $GITHUB_ENV
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "Clean up Docker image $IMAGE_ID:$VERSION"
- name: Delete image
uses: bots-house/[email protected]
with:
owner: nationalarchives
name: ${{ env.IMAGE_ID }}
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ env.VERSION }}
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,34 @@ jobs:
fail_ci_if_error: true
move_coverage_to_trash: true

prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
- name: Install npm modules
run: npm install
- name: Lint SCSS and JS
run: npm run lint

compile-javascript:
name: Compile JavaScript
runs-on: ubuntu-latest
needs: prettier
steps:
- uses: actions/checkout@v3
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
- name: Install npm modules
run: npm install
- name: Compile JavaScript
run: npm run compile:js

test-javascript:
runs-on: ubuntu-latest
steps:
Expand All @@ -88,3 +116,16 @@ jobs:
run: npm install
- name: Run jest tests
run: npm test

compile-sass:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
- name: Install npm modules
run: npm install
- name: Compile SCSS
run: npm run compile:css
6 changes: 2 additions & 4 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ jobs:
- uses: hadolint/[email protected]
with:
dockerfile: Dockerfile
- name: Build image
run: docker build --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" --platform=linux/amd64 .
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
- name: Push image
- name: Build and push image
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
# Change all uppercase to lowercase
Expand All @@ -40,5 +38,5 @@ jobs:
[ "$VERSION" == "main" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker build --tag $IMAGE_ID:$VERSION --platform=linux/amd64 .
docker push $IMAGE_ID:$VERSION
9 changes: 2 additions & 7 deletions .platform.app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,9 @@ hooks:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install v18.16.0
nvm use v18.16.0
nvm install
npm install
npm install -g sass
sass --quiet-deps --style=compressed --load-path=node_modules sass/etna.scss:templates/static/css/dist/etna.css
npx webpack --config webpack.config.js
npm run compile
poetry run python manage.py collectstatic --no-input
deploy: |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Generated by Django 4.2.4 on 2023-08-07 09:14

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("articles", "0096_focusedarticlepage_article_tag_names_and_more"),
]

operations = [
migrations.AlterField(
model_name="articlepage",
name="mark_new_on_next_publish",
field=models.BooleanField(
default=True,
help_text="This will set the 'new' label for 21 days",
verbose_name="mark this page as 'new' when published",
),
),
migrations.AlterField(
model_name="articlepage",
name="newly_published_at",
field=models.DateField(
default=None,
editable=False,
null=True,
verbose_name="Page marked as new on",
),
),
migrations.AlterField(
model_name="focusedarticlepage",
name="mark_new_on_next_publish",
field=models.BooleanField(
default=True,
help_text="This will set the 'new' label for 21 days",
verbose_name="mark this page as 'new' when published",
),
),
migrations.AlterField(
model_name="focusedarticlepage",
name="newly_published_at",
field=models.DateField(
default=None,
editable=False,
null=True,
verbose_name="Page marked as new on",
),
),
migrations.AlterField(
model_name="recordarticlepage",
name="mark_new_on_next_publish",
field=models.BooleanField(
default=True,
help_text="This will set the 'new' label for 21 days",
verbose_name="mark this page as 'new' when published",
),
),
migrations.AlterField(
model_name="recordarticlepage",
name="newly_published_at",
field=models.DateField(
default=None,
editable=False,
null=True,
verbose_name="Page marked as new on",
),
),
]
10 changes: 9 additions & 1 deletion etna/core/models/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ class NewLabelMixin(models.Model):
mark_new_on_next_publish = models.BooleanField(
verbose_name="mark this page as 'new' when published",
default=True,
help_text="This will set the 'new' label for 21 days",
)

newly_published_at = models.DateField(
editable=False,
verbose_name="Page marked as new on",
default=None,
null=True,
)
Expand Down Expand Up @@ -98,7 +100,13 @@ def is_newly_published(self):
return False

promote_panels = [
FieldPanel("mark_new_on_next_publish"),
MultiFieldPanel(
[
FieldPanel("mark_new_on_next_publish"),
FieldPanel("newly_published_at", read_only=True),
],
heading="New label",
)
]

class Meta:
Expand Down
7 changes: 7 additions & 0 deletions etna/core/static/css/wagtail-overrides.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,10 @@ Wagtail 4.1 upgrade changes breaking the CSS to display on hover */
opacity: 1;
}
}

/* TODO: Remove after wagtail/wagtail-generic-chooser fix
is released. This is a temporary fix for the record chooser
widget, due to Wagtail 5.1 upgrade changes breaking the icons */
.chooser__preview .icon-snippet {
width: 95%;
}
2 changes: 1 addition & 1 deletion lint-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
flake8==6.0.0
flake8==6.1.0
isort==5.12.0
black==23.7.0
Loading

0 comments on commit 1b9a0f1

Please sign in to comment.