Skip to content

Commit

Permalink
feat: add github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
id88 committed Oct 10, 2023
1 parent 42ffa8a commit 26d651d
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: MyWorkflows

run-name: Deploy to ${{ inputs.deploy_target }} by @${{ github.actor }}
# https://docs.github.com/zh/actions/learn-github-actions/contexts#inputs-context
# https://docs.github.com/zh/actions/learn-github-actions/contexts#github-context

on:
push: # <event_name>
branches: [main]
paths-ignore:
- "**.md"
- "**.spec.js"
- ".idea"
- ".vscode"
- ".dockerignore"
- "Dockerfile"
- ".gitignore"
- ".github/**"
- "!.github/workflows/build.yml"

jobs:
my-job: # 自定义的<job_id>
runs-on: ubuntu-latest
steps:
- name: Say hello for me
env::
MY_VAR: Hello there!
run: |
echo $MY_VAR
echo "The workflows is running..."
build-project: # 自定义的<job_id>
runs-on: ${{ matrix.os }}

strategy:
# https://docs.github.com/zh/actions/learn-github-actions/contexts#about-contexts
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]

steps:
- name: Checkout Code # https://docs.github.com/zh/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsname
uses: actions/checkout@v3 # https://docs.github.com/zh/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsname

- name: Setup Node.js
uses: actions/setup-node@v3
with: # https://docs.github.com/zh/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepswith
node-version: 18

- name: Install Dependencies
run: npm install # https://docs.github.com/zh/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

- name: Build Release Files
run: npm run build
env: # https://docs.github.com/zh/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsenv-%E7%9A%84%E7%A4%BA%E4%BE%8B
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://docs.github.com/zh/actions/security-guides/automatic-token-authentication

- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: release_on_${{ matrix.os }}
path: release/
retention-days: 5
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

## 2023年10月10日
- 添加 gihtub action

0 comments on commit 26d651d

Please sign in to comment.