Skip to content

Commit

Permalink
build: setup build chain
Browse files Browse the repository at this point in the history
  • Loading branch information
kyubisation committed Jun 13, 2023
1 parent f9d1579 commit ff98c58
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 47 deletions.
15 changes: 15 additions & 0 deletions .github/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
tcp_nopush on;
tcp_nodelay on;
types_hash_max_size 2048;

server {
listen 8080 default_server;
server_name _;
root /usr/share/nginx/html;
index index.html index.htm;

location / {
add_header Cache-Control "no-cache";
try_files $uri $uri/ /index.html =404;
}
}
44 changes: 44 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Continuous Integration
on: [push, pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: 'npm'
node-version-file: '.nvmrc'
- run: npm ci
- run: npm run build
- uses: actions/upload-artifact@v3
if: github.ref == 'refs/heads/main'
with:
name: showcase
path: dist/

showcase:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main'
env:
IMAGE_REPO: ghcr.io/${{ github.repository }}/showcase
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: showcase
path: dist/
- name: 'Container: Login to GitHub Container Repository'
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io --username ${{ github.actor }} --password-stdin
- name: 'Container: Build image'
run: docker build -t $IMAGE_REPO:latest .
env:
DOCKER_BUILDKIT: 1
- name: 'Container: Publish image'
run: docker push $IMAGE_REPO:latest
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Release
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-*'

permissions:
packages: write

jobs:
showcase:
runs-on: ubuntu-latest
env:
IMAGE_REPO: ghcr.io/${{ github.repository }}/showcase
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: 'npm'
node-version-file: '.nvmrc'
- run: npm ci
- run: npm run build

- name: 'Container: Login to GitHub Container Repository'
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io --username ${{ github.actor }} --password-stdin
- name: 'Container: Build image'
run: docker build -t $IMAGE_REPO:${{ github.ref_name }} .
env:
DOCKER_BUILDKIT: 1
- name: 'Container: Publish image'
run: docker push $IMAGE_REPO:${{ github.ref_name }}
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM cloud.docker.bin.sbb.ch/cloud/plattform-nginx:1.20.2-rootless
FROM nginxinc/nginx-unprivileged:stable

# Copy nginx configuration
COPY ./.github/default.conf /etc/nginx/conf.d/default.conf

# Copy dist files to nginx html folder
COPY dist .
COPY dist /usr/share/nginx/html
45 changes: 0 additions & 45 deletions estaTektonPipeline.json

This file was deleted.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "1.0.0",
"description": "digital.sbb.ch",
"main": "index.js",
"private": true,
"scripts": {
"copy:components": "npx copyfiles -f ./node_modules/list.js/dist/* dist/assets/js/listjs/ && npx copyfiles -u 5 ./node_modules/@sbb-esta/lyne-components/dist/lyne-components/*.* dist/assets/js/lyne-components/ && npx copyfiles -u 4 ./node_modules/ux-components/dist/ux-components/*.* dist/assets/js/ux-components/",
"html-minify": "html-minifier --input-dir dist --output-dir dist --file-ext html --remove-comments --collapse-whitespace --conservative-collapse --minify-js false --minify-css true",
Expand Down

0 comments on commit ff98c58

Please sign in to comment.