Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .devContainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "Node.js",
"image": "docker.pkg.github.com/peaceiris/actions-gh-pages/dev:latest",

// Use 'settings' to set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},

// Add the IDs of extensions you want installed when the container is created in the array below.
"extensions": [
"bungcip.better-toml",
"EditorConfig.EditorConfig",
"donjayamanne.githistory",
"eamodio.gitlens",
"oderwat.indent-rainbow",
"yzhang.markdown-all-in-one",
"shd101wyy.markdown-preview-enhanced",
"christian-kohler.path-intellisense",
"lfs.vscode-emacs-friendly",
"ms-azuretools.vscode-docker",
"dbaeumer.vscode-eslint",
"firsttris.vscode-jest-runner",
"VisualStudioExptTeam.vscodeintellicode"
],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [3000],

// Specifies a command that should be run after the container has been created.
"postCreateCommand": "npm ci"

// Comment out the next line to run as root instead.
// "remoteUser": "runner"
}
3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Please use the reaction to show that you are affected by the same issue.
- Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
- Subscribe to receive notifications on status change and new comments.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: 'enhancement'
assignees: 'orangzz'
---


<!-- Please also try to search for your request to avoid it being closed as a duplicate. -->

**What you want to do:**

**What we does currently:**

<!-- This is probably where you explain how you'd use this feature. -->
**Why you think this should be added:**

<!-- If applicable. -->
**Examples of other projects that have something similar:**
14 changes: 14 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

## Types of changes

- [ ] New feature (non-breaking change which adds functionality)
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Documentation (no code change)

## Checklist

- [ ] I have documented what and why the change is made.
- [ ] I have followed the code style of this project.
- [ ] I have added tests to cover my changes.
32 changes: 32 additions & 0 deletions .github/actions/image-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build and Push Image

on:
push:
tags: ['v*.*.*']

env:
acr_registry:
aws_registry:
dockerhub: docker.io
ghcr_registry: ghcr.io
# ghcr_registry_username: ${{ env.GHCR_USERNAME }}
# ghcr_registry_token: ${{ secrets.GHCR_TOKEN }}

jos:
build:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout codebase
uses: actions/checkout@v4
- name: Login to ghcr.io
uses: redhat-actions/podman-login@v2
with:
username: ${{ env.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
registry: ${{ env.ghcr_registry }}
# - name: Login to ghcr.io
# run: |
# echo ${{ secrets.ghcr_token }} | docker login -u ${{ env.ghcr_username}} --password-stdin ${{ env.ghcr_registry }}
31 changes: 31 additions & 0 deletions .github/actions/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
on:
workflow_dispatch:
push:
tags: ['v*']
jobs:
release:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
node-version: [22]
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: checkout to release branch
run: git checkout ${{ github.ref }}
- name: configure ci user
run: |
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org/
- uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node
- run: npm install
15 changes: 15 additions & 0 deletions .github/workflow-scripts/bump-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// bump-version:
// runs-on: ubuntu-latest
// steps:
// - uses: actions/checkout
// - uses: actions/setup-node
// with:
// node-version: '22'
// - name: Setup Git
// run: |
// git config.user.name ${{ github.actor }}
// git config.user.email ${{ github.actor }}@users.noreply.github.com
// - name: Bump version
// run: npm version ${{ github.event.inputs.version }}
// - name: Push latest version
// run: git push --tags origin main
59 changes: 59 additions & 0 deletions .github/workflow-scripts/changelog-pr.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
function _generateChangelog(prevVersion, version) {}

function _pushCommit(version) {
log(`Pushing commit to changelog/v${version}`)
run(`git checkout -b changelog/v${version}`)
run(`git add CHANGELOG.md`)
run(`git commit -m "changelog: Add changelog for v${version}`)
run(`git push origin changelog/v${version}`)
}

async function _createPR(version, token) {
log(`Creating changelog pr`)
const url = 'https://api.github.com/repos/orangzz/dotfiles/pulls'
const body = `
## Summary
Add Changelog for ${version}
`
const response = await fetch(url, {
method: 'POST',
headers: {
Accept: 'Accept: application/vnd.github+json',
'X-GitHub-Api-Version': '2022-11-28',
Authorization: `Bearer ${token}`,
},
body: JSON.stringify({
title: `changelog: Add changelog for v${version}`,
head: `changelog/v${version}`,
base: 'main',
body: body,
}),
})
const data = await response.json()
if (response.status !== 201) {
throw new Error(`
Failed to create PR
received status code ${response.status}
${data.message}\n${JSON.stringify(data.errors)}`)
}
return data.html_url
}

async function generateChangelog(version, token) {
if (version.startsWith('v')) {
version = version.substring(1)
}

const previousVersion = await _computePreviousVersionFrom(version)
if (previousVersion) {
log(`Previous version is ${previousVersion}`)
_generateChangelog(previousVersion, version, token)
_pushCommit(version)
const prURL = await _createPR(version, token)
log(`Created PR: ${prURL}`)
}
}

module.exports = {
generateChangelog,
}
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
on:
pull_request:
types: [closed]
branches: [$default-branch]

jobs:
test:
strategy:
matrix:
os: [ubuntu-latest]
node-version: [22.x, 23.x]
runs-on: ${{ matrix.os}}
steps:
- uses: actions/checkout
- uses: actions/setup-node
- run: npx playwright install --with-deps # # instead of local installed binary
- run: npx playwright test
- uses: actions/upload-artifact
if: always()
with:
name: release-report
path: playwright-report
retention-days: 30
notify:
runs-on: ubuntu-latest
needs: test
if: failure() && (github.repository_owner == 'orangzz')
steps:
- name: Notify IRC
uses: Gottox/irc-message-action@v2
with:
channel: '#dotfiles'
nickname: ghaction-ci-bot
message: '${{ github.ref }} failed tests: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
74 changes: 74 additions & 0 deletions .github/workflows/deploy-site.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
on:
push:
branches: [$default-branch]
paths: ['/docs/**', 'README.md', '.github/workflows/deploy-site.yml']
pull_request:
paths: ['/docs/**', 'README.md', '.github/workflows/deploy-site.yml']
workflow_dispatch:

concurrency:
group: "pages"
cancel-in-progress: true

permissions:
contents: write
id-token: write # request the OIDC id-token
pages: write

jobs:
deploy-site:
name: Build and deploy site
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- name: Checkout codebase
uses: actions/checkout@v4
- name: Prepare docs
run: |
cp README.md docs/src/README.md
- name: Install mdbook
run: |
tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name')
url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz"
# url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-aarch64-apple-darwin.tar.gz"
mkdir mdbook
curl -sSL $url | tar -xz --directory=./mdbook
# curl -sSL $url | tar -xz --directory=$HOME/.local/bin
echo "$(pwd)/mdbook" >> $GITHUB_PATH
- name: Build Book
run: |
mdbook build docs --dest-dir book
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/book

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
# - name: Upload artifact
# run: |
# git worktree add gh-pages
# git config --local user.name "github-actions[bot]"
# git config --local user.email "github-actions[bot]@users.noreply.github.com"
# cd gh-pages
# git update-ref -d refs/heads/gh-pages
# rm -rf *
# mv ../docs/* .
# git add .
# git commit -m "deploy ${GITHUB_SHA} to gh-pages"
# git push --force --set-upstream origin gh-pages
# - name: Upload artifact
# uses: actions/upload-pages-artifact@v3
# with:
# path: ./docs/book
# - name: Deploy site to Github Page
# uses: peaceiris/actions-gh-pages@v3
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# publish_dir: ./docs/book
# user_name: 'github-actions[bot]'
# user_email: 'github-actions[bot]@users.noreply.github.com'
20 changes: 20 additions & 0 deletions .github/workflows/generate-changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Generate Changelog

on:
workflow_call:
jobs:
generate-changelog:
runs-on: ubuntu-latest
steps:
- name: Checkout codebase
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Generate changelog
uses: actions/github-script@v6
with:
script: |
const {generateChangelog} = require('./github/workflow-scripts/generateChangelog')
const version = '${{ github.ref_name}}'
await generateChangelog(version, '${{ github.token}}')
31 changes: 31 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Release

on:
push:
tags: ['v*.*.*']
# defaults:
# run:
# working-directory: ./docs

env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN}}
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

jobs:
npm-publish:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os}}
steps:
- uses: actions/checkout
- uses: actions/setup-node@v4
with:
node-version-file: '.tool-versions'
cache: 'pnpm'
- name: Publish to npm
run: |
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
npm publish --access public
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN}}
Loading