Skip to content

Commit 1dbe6a4

Browse files
committed
Merge branch 'release/1.2.6'
2 parents 2aa2c1d + 033f71c commit 1dbe6a4

File tree

10 files changed

+146
-80
lines changed

10 files changed

+146
-80
lines changed

.github/workflows/docker_build_develop.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,30 @@ jobs:
1414

1515
steps:
1616
- name: Checkout
17-
uses: actions/checkout@v2
18-
19-
- name: Docker meta
20-
id: meta
21-
uses: docker/metadata-action@v3
22-
with:
23-
images: itkdev/os2display-client
17+
uses: actions/checkout@v3
2418

2519
- name: Login to DockerHub
26-
uses: docker/login-action@v1
20+
uses: docker/login-action@v2
2721
with:
2822
username: ${{ secrets.DOCKERHUB_USER }}
2923
password: ${{ secrets.DOCKERHUB_TOKEN }}
3024

25+
- name: Docker meta
26+
id: meta
27+
uses: docker/metadata-action@v4
28+
with:
29+
images: os2display/os2display-client
30+
31+
- name: Set up Docker Buildx
32+
uses: docker/setup-buildx-action@v2
33+
3134
- name: Set release timestamp
3235
run: |
3336
echo "APP_RELEASE_TIMESTAMP=$(echo $(date +%s))" >> $GITHUB_ENV
3437
echo "APP_RELEASE_TIME=$(echo $(date))" >> $GITHUB_ENV
3538
3639
- name: Build and push (API)
37-
uses: docker/build-push-action@v2
40+
uses: docker/build-push-action@v4
3841
with:
3942
context: ./infrastructure/
4043
file: ./infrastructure/Dockerfile

.github/workflows/docker_build_tag.yml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,37 +10,36 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout
13-
uses: actions/checkout@v2
14-
15-
- name: Docker meta
16-
id: meta
17-
uses: docker/metadata-action@v3
18-
with:
19-
images: itkdev/os2display-client
13+
uses: actions/checkout@v3
2014

2115
- name: Login to DockerHub
22-
uses: docker/login-action@v1
16+
uses: docker/login-action@v2
2317
with:
2418
username: ${{ secrets.DOCKERHUB_USER }}
2519
password: ${{ secrets.DOCKERHUB_TOKEN }}
2620

21+
- name: Docker meta
22+
id: meta
23+
uses: docker/metadata-action@v4
24+
with:
25+
images: os2display/os2display-client
26+
27+
- name: Set up Docker Buildx
28+
uses: docker/setup-buildx-action@v2
29+
2730
- name: Set release timestamp
2831
run: |
2932
echo "APP_RELEASE_TIMESTAMP=$(echo $(date +%s))" >> $GITHUB_ENV
3033
echo "APP_RELEASE_TIME=$(echo $(date))" >> $GITHUB_ENV
3134
32-
- name: Get the tag
33-
id: get_tag
34-
run: echo ::set-output name=git_tag::$(echo $GITHUB_REF_NAME)
35-
3635
- name: Build and push (API)
37-
uses: docker/build-push-action@v2
36+
uses: docker/build-push-action@v4
3837
with:
3938
context: ./infrastructure/
4039
file: ./infrastructure/Dockerfile
4140
build-args: |
4241
APP_VERSION=${{ github.ref }}
43-
APP_RELEASE_VERSION=${{ steps.get_tag.outputs.git_tag }}
42+
APP_RELEASE_VERSION=$GITHUB_REF_NAME
4443
APP_RELEASE_TIMESTAMP=${{ env.APP_RELEASE_TIMESTAMP }}
4544
APP_RELEASE_TIME=${{ env.APP_RELEASE_TIME }}
4645
push: true
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
on:
2+
push:
3+
tags:
4+
- '*.*.*'
5+
6+
name: Create Github Release
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
create-release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v3
17+
18+
- name: Make build dir
19+
run: |
20+
mkdir -p build
21+
22+
- name: Build assets
23+
run: |
24+
docker network create frontend
25+
docker compose run --rm node yarn install
26+
docker compose run --rm node yarn build
27+
28+
- name: Create release file
29+
run: |
30+
rm build/example_release.json
31+
printf "{\n \"releaseTimestamp\": $(date +%s),\n \"releaseTime\": \"$(date)\",\n \"releaseVersion\": \"${{ github.ref_name }}\"\n}" > build/release.json
32+
cat build/release.json
33+
34+
- name: Rename build dir
35+
# Make archive directory name match expected build "homepage": "/client/",
36+
run: |
37+
mv build/ client
38+
39+
- name: Make artefacts dir
40+
run: |
41+
mkdir -p ../assets
42+
43+
- name: Create archive
44+
run: |
45+
tar \
46+
--exclude ='client/fixtures' \
47+
-zcf ../assets/${{ github.event.repository.name }}-${{ github.ref_name }}.tar.gz client/*
48+
49+
- name: Create checksum
50+
run: sha256sum ../assets/${{ github.event.repository.name }}-${{ github.ref_name }}.tar.gz > ../assets/checksum.txt
51+
52+
- name: Create a release in GitHub and uploads assets
53+
run: |
54+
gh release create ${{ github.ref_name }} --verify-tag --generate-notes ../assets/*.*
55+
env:
56+
GITHUB_TOKEN: ${{ github.TOKEN }}
57+
shell: bash

.github/workflows/pr.yml

Lines changed: 24 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,35 @@
11
on: pull_request
2-
name: Review
2+
name: Pull Request Review
33
jobs:
44
frontend-build:
55
name: Frontend build
66
runs-on: ubuntu-latest
7-
container: node:14
87
steps:
9-
- uses: actions/checkout@v2
10-
- name: Cache node modules
11-
uses: actions/cache@v2
12-
env:
13-
cache-name: cache-node-modules
14-
with:
15-
path: ~/.yarn
16-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
17-
restore-keys: |
18-
${{ runner.os }}-build-${{ env.cache-name }}-
19-
${{ runner.os }}-build-
20-
${{ runner.os }}-
21-
- name: install
22-
run: yarn
8+
- name: Checkout
9+
uses: actions/checkout@v3
2310

24-
- name: Build production assets
25-
run: yarn build
11+
- name: Make build dir
12+
run: |
13+
mkdir -p build
14+
15+
- name: Build assets
16+
run: |
17+
docker network create frontend
18+
docker compose run --rm node yarn install
19+
docker compose run --rm node yarn build
2620
2721
frontend-coding-standards:
2822
name: Frontend coding standards
2923
runs-on: ubuntu-latest
30-
container: node:14
3124
steps:
32-
- uses: actions/checkout@v2
33-
34-
- name: Cache node modules
35-
uses: actions/cache@v2
36-
env:
37-
cache-name: cache-node-modules
38-
with:
39-
path: ~/.yarn
40-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
41-
restore-keys: |
42-
${{ runner.os }}-build-${{ env.cache-name }}-
43-
${{ runner.os }}-build-
44-
${{ runner.os }}-
45-
- name: install
46-
run: yarn
25+
- name: Checkout
26+
uses: actions/checkout@v3
4727

4828
- name: React coding standards
49-
run: yarn check-coding-standards
29+
run: |
30+
docker network create frontend
31+
docker compose run --rm node yarn install
32+
docker compose run --rm node yarn check-coding-standards
5033
5134
cypress:
5235
name: Cypress
@@ -57,33 +40,33 @@ jobs:
5740
browser: ["chrome"]
5841
steps:
5942
- name: Checkout
60-
uses: actions/checkout@v2
43+
uses: actions/checkout@v3
6144

6245
- name: Setup network
6346
run: docker network create frontend
6447

6548
- name: Install client
66-
run: docker-compose run node yarn
49+
run: docker compose run node yarn
6750

6851
- name: Cypress run
69-
run: docker-compose run cypress run --browser ${{ matrix.browser }}
52+
run: docker compose run cypress run --browser ${{ matrix.browser }}
7053

7154
- name: Archive screenshots
7255
if: ${{ failure() }}
7356
uses: actions/upload-artifact@v2
7457
with:
75-
name: cypress-screenhosts-${{ matrix.browser }}
58+
name: cypress-screenshots-${{ matrix.browser }}
7659
path: cypress/screenshots
7760
retention-days: 7
7861

7962
changelog:
80-
runs-on: ubuntu-20.04
63+
runs-on: ubuntu-latest
8164
name: Changelog should be updated
8265
strategy:
8366
fail-fast: false
8467
steps:
8568
- name: Checkout
86-
uses: actions/checkout@v2
69+
uses: actions/checkout@v3
8770
with:
8871
fetch-depth: 2
8972

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
44

55
## [Unreleased]
66

7+
## [1.2.6] - 2023-06-12
8+
9+
- [#105](https://github.com/os2display/display-client/pull/105)
10+
Update docker build to publish to "os2display" org on docker hup.
11+
Update github workflow to latest actions.
12+
Add github workflow to build and create release.
13+
Change `example_config.json` to use relative paths.
14+
715
## [1.2.5] - 2023-06-06
816

917
- [#104](https://github.com/os2display/display-client/pull/104)

README.md

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ Start docker setup
99

1010
```
1111
# Install npm packages
12-
docker-compose run node yarn install
12+
docker compose run node yarn install
1313
1414
# Up the containers
15-
docker-compose up -d
15+
docker compose up -d
1616
1717
# Optional: Follow the node logs to see when the code is compiled.
18-
docker-compose logs -f node
18+
docker compose logs -f node
1919
```
2020

2121
The display client is here: `http://display-client.local.itkdev.dk/`.
@@ -34,10 +34,10 @@ For code analysis we use the [Airbnb style guide for javascript](https://github.
3434

3535
```
3636
# Check for coding standards issues
37-
docker-compose exec node bash -c 'yarn check-coding-standards'
37+
docker compose exec node bash -c 'yarn check-coding-standards'
3838
3939
# Auto-correct coding standards issues
40-
docker-compose exec node bash -c 'yarn apply-coding-standards'
40+
docker compose exec node bash -c 'yarn apply-coding-standards'
4141
```
4242

4343
## Testing with cypress
@@ -47,11 +47,26 @@ We use [cypress](https://www.cypress.io/) for testing.
4747
To run cypress tests in the cypress container:
4848

4949
```
50-
docker-compose run cypress run
50+
docker compose run cypress run
5151
```
5252

5353
## Build for production
5454

55-
Builds the app for production to the build folder.
55+
Github actions will build both docker images published to [docker hub](https://hub.docker.com/repository/docker/os2display/os2display-client/general) and release assets published as [github releases](https://github.com/os2display/display-client/releases). To run the display client choose which option suits you and download it.
5656

57-
@TODO: Add production build instructions.
57+
If you wish to do your own production build, you need to do
58+
```shell
59+
docker compose run node yarn install
60+
docker compose run node yarn build
61+
62+
# Make release file. Replace 'x.y.z' with relevant release version
63+
printf "{\n \"releaseTimestamp\": $(date +%s),\n \"releaseTime\": \"$(date)\",\n \"releaseVersion\": \"x.y.z\"\n}" > build/release.json
64+
65+
# Make config file
66+
cp public/example_config.json build/config.json
67+
```
68+
69+
This will build the client configured to be hosted at `/client`. If you wish to host at a different path
70+
you need to edit `homepage` in `package.json` and re-build.
71+
72+
For instructions on how to host a complete OS2display setup please see the [docs](https://os2display.github.io/display-docs/).

infrastructure/etc/confd/templates/config.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"apiEndpoint": "{{ getenv "APP_API_ENDPOINT" "" }}",
2+
"apiEndpoint": "{{ getenv "APP_API_ENDPOINT" "/" }}",
33
"authenticationEndpoint": "{{ getenv "APP_API_AUTHENTICATION_ENDPOINT" "/v1/authentication/token" }}",
44
"authenticationRefreshTokenEndpoint": "{{ getenv "APP_API_AUTHENTICATION_REFRESH_ENDPOINT" "/v1/authentication/token/refresh" }}",
55
"dataStrategy": {

infrastructure/run.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ APP_RELEASE_TIME=$(date)
77
APP_VERSION=develop
88
VERSION=alpha
99

10-
docker build --pull --no-cache --build-arg APP_VERSION=${APP_VERSION} --build-arg APP_RELEASE_TIMESTAMP="${APP_RELEASE_TIMESTAMP}" --build-arg APP_RELEASE_TIME="${APP_RELEASE_TIME}" --tag=itkdev/os2display-client:${VERSION} --file="Dockerfile" .
10+
docker build --pull --no-cache --build-arg APP_VERSION=${APP_VERSION} --build-arg APP_RELEASE_TIMESTAMP="${APP_RELEASE_TIMESTAMP}" --build-arg APP_RELEASE_TIME="${APP_RELEASE_TIME}" --tag=os2display/os2display-client:${VERSION} --file="Dockerfile" .
1111

12-
# docker push itkdev/os2display-client:${VERSION}
12+
# docker push os2display/os2display-client:${VERSION}

public/example_config.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"apiEndpoint": "https://displayapiservice.local.itkdev.dk",
3-
"authenticationEndpoint": "https://displayapiservice.local.itkdev.dk/v1/authentication/screen",
4-
"authenticationRefreshTokenEndpoint": "https://displayapiservice.local.itkdev.dk/v1/authentication/token/refresh",
2+
"apiEndpoint": "/",
3+
"authenticationEndpoint": "/v1/authentication/screen",
4+
"authenticationRefreshTokenEndpoint": "/v1/authentication/token/refresh",
55
"dataStrategy": {
66
"type": "pull",
77
"config": {
88
"interval": 30000,
9-
"endpoint": "https://displayapiservice.local.itkdev.dk"
9+
"endpoint": "/"
1010
}
1111
},
1212
"colorScheme": {

public/example_release.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2-
"releaseTimestamp": 1651175120,
2+
"releaseTimestamp": 1686045152,
3+
"releaseTime": "Tue Jun 6 09:52:32 UTC 2023",
34
"releaseVersion": "1.0.0"
45
}

0 commit comments

Comments
 (0)