Skip to content

Commit

Permalink
Merge pull request #66 from naruhiyo/feature/upgrade-workflow
Browse files Browse the repository at this point in the history
Feature/upgrade workflow
  • Loading branch information
aecomet authored Jul 6, 2024
2 parents ef8b723 + 8a15988 commit aae9660
Show file tree
Hide file tree
Showing 10 changed files with 538 additions and 406 deletions.
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ docker-compose.yml
Dockerfile

.github
.gitignore
.gitignore
.editorconfig
112 changes: 112 additions & 0 deletions .github/workflows/app-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Application Build & Publish to pages

on:
push:
branches: main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write
packages: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: 'pages'
cancel-in-progress: false

jobs:
build:
name: Build app
runs-on: ubuntu-latest

steps:
- name: Checkout branch
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9.4.0

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22.4.0
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build app
run: pnpm run build

- name: Setup Pages
uses: actions/configure-pages@v5

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './build'

deploy:
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest

steps:
- uses: actions/deploy-pages@v4

- name: Release Drafter
uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build-image:
needs: deploy
name: Build image
runs-on: ubuntu-latest

steps:
- name: Checkout branch
uses: actions/checkout@v4

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Enable docker buildx
uses: docker/setup-buildx-action@v3

- uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/${{ github.repository_owner }}/portfolio
tags: |
type=raw,value=latest
labels: |
org.opencontainers.image.title=Naruhiyo Project Portfolio
org.opencontainers.image.description=A portfolio for Naruhiyo Project
org.opencontainers.image.authors=comet
org.opencontainers.image.url=https://github.com/naruhiyo/naruhiyo.github.io/pkgs/container/portfolio
org.opencontainers.image.source=https://github.com/naruhiyo/naruhiyo.github.io
org.opencontainers.image.version=latest
- name: Build and Push a Image
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
context: .
file: Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
66 changes: 66 additions & 0 deletions .github/workflows/lint-runner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Lint Runner

on: [pull_request]

jobs:
reviewdog:
name: Reviewdog
runs-on: ubuntu-latest

permissions:
contents: read
pull-requests: write

container:
image: ghcr.io/aecomet/reviewdog-base:22.4.0
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.PERSONAL_ACCESS_TOKEN_FOR_ACTIONS }}

steps:
- name: Checkout branch
uses: actions/checkout@v4

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Run reviewdog
uses: reviewdog/action-eslint@v1
with:
reporter: github-check
eslint_flags: 'src/'

commitlint:
name: Commitlint
runs-on: ubuntu-latest

permissions:
contents: read
pull-requests: write

container:
image: ghcr.io/aecomet/commitlint-base:22.4.0
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.PERSONAL_ACCESS_TOKEN_FOR_ACTIONS }}

steps:
- name: Get depth
run: echo "fetch_depth=$(( ${{ env.commits }} + 1 ))" >> $GITHUB_ENV
env:
commits: ${{ github.event.pull_request.commits }}

- name: Checkout branch
uses: actions/checkout@v4
with:
fetch-depth: ${{ env.fetch_depth }}

- name: Set dir as safe directory
run: git config --global --add safe.directory $(pwd)

- name: Run commitlint
run: pnpx commitlint --from ${{ env.from }} --to ${{ env.to }} --verbose --config ${{ env.config }}
env:
from: ${{ github.event.pull_request.base.sha }}
to: ${{ github.event.pull_request.head.sha }}
config: /app/commitlint.config.mjs
40 changes: 0 additions & 40 deletions .github/workflows/release.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
22.2.0
22.4.0
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:22.2.0-slim as builder
FROM node:22.4.0-slim as builder

WORKDIR /app
COPY --chown=node:node . /app
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,18 @@

### Quick Preview

### Quick Preview

```sh
docker-compose up -d web
docker run -p 8888:80 --rm ghcr.io/aecomet/portfolio
# => http://localhost:8888/
```

### Set up local

```sh
node -v
# => v22.2.0
# => v22.4.0

npm i -g pnpm

Expand Down
7 changes: 0 additions & 7 deletions docker-compose.yml

This file was deleted.

26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "naruhiyo.github.io",
"version": "2.3.0",
"version": "2.4.0",
"description": "Portofilo of NaruHiyo Project",
"scripts": {
"dev": "vite",
Expand All @@ -25,20 +25,20 @@
"@childrentime/devcert": "^1.2.8",
"@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2",
"@eslint/js": "^9.4.0",
"@eslint/js": "^9.6.0",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.3.0",
"critters": "^0.0.22",
"eslint": "^9.4.0",
"@vitejs/plugin-react": "^4.3.1",
"critters": "^0.0.24",
"eslint": "^9.6.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.34.2",
"globals": "^15.4.0",
"prettier": "^3.3.1",
"typescript": "^5.4.5",
"typescript-eslint": "^7.12.0",
"vite": "^5.2.13",
"eslint-plugin-react": "^7.34.3",
"globals": "^15.8.0",
"prettier": "^3.3.2",
"typescript": "^5.5.3",
"typescript-eslint": "^7.15.0",
"vite": "^5.3.3",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-eslint": "^1.8.1",
"vite-plugin-html": "^3.2.2",
Expand All @@ -48,8 +48,8 @@
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@fontsource/roboto": "^5.0.13",
"@mui/icons-material": "^5.15.19",
"@mui/material": "^5.15.19",
"@mui/icons-material": "^5.16.0",
"@mui/material": "^5.16.0",
"react": "^18.3.1",
"react-dom": "^18.3.1"
}
Expand Down
Loading

0 comments on commit aae9660

Please sign in to comment.