Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
modstart committed Dec 16, 2024
0 parents commit 64fd897
Show file tree
Hide file tree
Showing 376 changed files with 27,165 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml, yaml}]
indent_size = 4

[*.{less, css}]
indent_size = 4


11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---

name: 🐞 Bug report
about: Create a report to help us improve
title: "[Bug] the title of bug report"
labels: bug
assignees: ''

---

#### Describe the bug
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/help_wanted.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: 🥺 Help wanted
about: Confuse about the use of electron-vue-vite
title: "[Help] the title of help wanted report"
labels: help wanted
assignees: ''

---

#### Describe the problem you confuse
12 changes: 12 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!-- Thank you for contributing! -->

### Description

<!-- Please insert your description here and provide especially info about the "what" this PR is solving -->

### What is the purpose of this pull request? <!-- (put an "X" next to an item) -->

- [ ] Bug fix
- [ ] New Feature
- [ ] Documentation update
- [ ] Other
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "monthly"
81 changes: 81 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: CI

on:
pull_request_target:
branches:
- main

permissions:
pull-requests: write

jobs:
job1:
name: Check Not Allowed File Changes
runs-on: ubuntu-latest
outputs:
markdown_change: ${{ steps.filter_markdown.outputs.change }}
markdown_files: ${{ steps.filter_markdown.outputs.change_files }}
steps:

- name: Check Not Allowed File Changes
uses: dorny/paths-filter@v2
id: filter_not_allowed
with:
list-files: json
filters: |
change:
- 'package-lock.json'
- 'yarn.lock'
- 'pnpm-lock.yaml'
# ref: https://github.com/github/docs/blob/main/.github/workflows/triage-unallowed-contributions.yml
- name: Comment About Changes We Can't Accept
if: ${{ steps.filter_not_allowed.outputs.change == 'true' }}
uses: actions/github-script@v6
with:
script: |
let workflowFailMessage = "It looks like you've modified some files that we can't accept as contributions."
try {
const badFilesArr = [
'package-lock.json',
'yarn.lock',
'pnpm-lock.yaml',
]
const badFiles = badFilesArr.join('\n- ')
const reviewMessage = `👋 Hey there spelunker. It looks like you've modified some files that we can't accept as contributions. The complete list of files we can't accept are:\n- ${badFiles}\n\nYou'll need to revert all of the files you changed in that list using [GitHub Desktop](https://docs.github.com/en/free-pro-team@latest/desktop/contributing-and-collaborating-using-github-desktop/managing-commits/reverting-a-commit) or \`git checkout origin/main <file name>\`. Once you get those files reverted, we can continue with the review process. :octocat:\n\nMore discussion:\n- https://github.com/electron-vite/electron-vite-vue/issues/192`
createdComment = await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.number,
body: reviewMessage,
})
workflowFailMessage = `${workflowFailMessage} Please see ${createdComment.data.html_url} for details.`
} catch(err) {
console.log("Error creating comment.", err)
}
core.setFailed(workflowFailMessage)
- name: Check Not Linted Markdown
if: ${{ always() }}
uses: dorny/paths-filter@v2
id: filter_markdown
with:
list-files: shell
filters: |
change:
- added|modified: '*.md'
job2:
name: Lint Markdown
runs-on: ubuntu-latest
needs: job1
if: ${{ always() && needs.job1.outputs.markdown_change == 'true' }}
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Lint markdown
run: npx markdownlint-cli ${{ needs.job1.outputs.markdown_files }} --ignore node_modules
130 changes: 130 additions & 0 deletions .github/workflows/main-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: Build

on:
push:
branches:
- main

jobs:
build:
runs-on: self-hosted
# runs-on: ${{ matrix.os }}

strategy:
matrix:
include:
# - os: ubuntu-latest
# arch: [arm64, amd64]
# - os: macos-latest
# arch: [arm64, amd64]
- os: windows-latest
arch: [arm64, amd64]

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

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Build Prepare (macOS)
if: runner.os == 'macOS'
run: |
brew install python-setuptools
- name: Cert Prepare (macOS)
if: runner.os == 'macOS'
env:
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
run: |
echo "find-identity"
security find-identity -p codesigning
echo "$MACOS_CERTIFICATE" | base64 --decode > certificate.p12
security create-keychain -p "" build.keychain
security import certificate.p12 -k build.keychain -P "$MACOS_CERTIFICATE_PASSWORD" -T /usr/bin/codesign
security list-keychains -s build.keychain
security set-keychain-settings -t 3600 -u build.keychain
security unlock-keychain -p "" build.keychain
echo "find-identity"
security find-identity -v -p codesigning build.keychain
echo "find-identity"
security find-identity -p codesigning
echo "set-key-partition-list"
security set-key-partition-list -S apple-tool:,apple: -s -k "" -l "FocusAnyKey" -t private build.keychain
echo "find-certificate"
security find-certificate -a -c "FocusAnyKey" -p
echo "export"
security export -k build.keychain -t certs -f x509 -p -o certificate.cer
echo "add-trusted-cert"
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain certificate.cer
echo "find-identity"
security find-identity -p codesigning
- name: Install Dependencies
run: npm install

- name: Build Release Files
run: npm run build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Set Build Name ( Linux / macOS )
if: runner.os == 'Linux' || runner.os == 'macOS'
run: |
DIST_FILE_NAME=${{ runner.os }}-${{ runner.arch }}-v$(date +%Y%m%d_%H%M%S)-${RANDOM}
echo ::add-mask::$DIST_FILE_NAME
echo DIST_FILE_NAME=$DIST_FILE_NAME >> $GITHUB_ENV
- name: Set Build Name ( Windows )
if: runner.os == 'Windows'
shell: pwsh
run: |
$randomNumber = Get-Random -Minimum 10000 -Maximum 99999
$DIST_FILE_NAME = "Windows-X64-v$(Get-Date -Format 'yyyyMMdd_HHmmss')-$randomNumber"
Write-Host "::add-mask::$DIST_FILE_NAME"
echo "DIST_FILE_NAME=$DIST_FILE_NAME" >> $env:GITHUB_ENV
- name: Upload
uses: modstart/github-oss-action@master
with:
title: ${{ github.event.head_commit.message }}
key-id: ${{ secrets.OSS_KEY_ID }}
key-secret: ${{ secrets.OSS_KEY_SECRET }}
region: ${{ secrets.OSS_REGION }}
bucket: ${{ secrets.OSS_BUCKET }}
callback: ${{ secrets.OSS_CALLBACK }}
assets: |
dist-release/*.exe:focusany/focusany-${{ env.DIST_FILE_NAME }}/
dist-release/*.dmg:focusany/focusany-${{ env.DIST_FILE_NAME }}/
dist-release/*.AppImage:focusany/focusany-${{ env.DIST_FILE_NAME }}/
dist-release/*.deb:focusany/focusany-${{ env.DIST_FILE_NAME }}/
# - name: Upload Artifact Windows
# if: runner.os == 'Windows'
# uses: actions/upload-artifact@v4
# with:
# name: windows-artifact
# path: |
# dist-release/*.exe
#
# - name: Upload Artifact Macos
# if: runner.os == 'macOS'
# uses: actions/upload-artifact@v4
# with:
# name: macos-artifact
# path: |
# dist-release/*.dmg
#
# - name: Upload Artifact Linux
# if: runner.os == 'Linux'
# uses: actions/upload-artifact@v4
# with:
# name: linux-artifact
# path: |
# dist-release/*.AppImage
# dist-release/*.deb


86 changes: 86 additions & 0 deletions .github/workflows/tag-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Build

on:
push:
tags:
- v*.*.*

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
matrix:
include:
# - os: ubuntu-latest
# arch: [arm64, amd64]
- os: macos-latest
arch: [arm64, amd64]
- os: windows-latest
arch: [arm64, amd64]

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

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Build Prepare (macOS)
if: runner.os == 'macOS'
run: |
brew install python-setuptools
- name: Cert Prepare (macOS)
if: runner.os == 'macOS'
env:
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
run: |
echo "find-identity"
security find-identity -p codesigning
echo "$MACOS_CERTIFICATE" | base64 --decode > certificate.p12
security create-keychain -p "" build.keychain
security import certificate.p12 -k build.keychain -P "$MACOS_CERTIFICATE_PASSWORD" -T /usr/bin/codesign
security list-keychains -s build.keychain
security set-keychain-settings -t 3600 -u build.keychain
security unlock-keychain -p "" build.keychain
echo "find-identity"
security find-identity -v -p codesigning build.keychain
echo "find-identity"
security find-identity -p codesigning
echo "set-key-partition-list"
security set-key-partition-list -S apple-tool:,apple: -s -k "" -l "FocusAnyKey" -t private build.keychain
echo "find-certificate"
security find-certificate -a -c "FocusAnyKey" -p
echo "export"
security export -k build.keychain -t certs -f x509 -p -o certificate.cer
echo "add-trusted-cert"
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain certificate.cer
echo "find-identity"
security find-identity -p codesigning
- name: Install Dependencies
run: npm install

- name: Build Release Files
run: npm run build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Release Assets
uses: softprops/action-gh-release@v2
with:
draft: false
prerelease: false
fail_on_unmatched_files: false
files: |
dist-release/*.exe
dist-release/*.dmg
dist-release/*.AppImage
dist-release/*.deb
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

Loading

0 comments on commit 64fd897

Please sign in to comment.