GitHub Actions 实现 Release 自动发版
2023-05-13· 25min
#一、配置Tokens、Secrets
#新增 Personal access tokens
- Open: Settings->Developer Settings->Personal access tokens
- Create: Tokens(classic)->Generate new token
#配置 Project Actions secrets
- Open: ${Your Repository}->Settings->Secrets and variables
- Create: Secrets->New repository secret
#二、配置workflows
- 具体配置文件 .github/workflows/release-please.yml
name: Create Release
permissions:
contents: write
pull-requests: write
on:
push:
tags:
- v*
jobs:
release-please:
runs-on: ubuntu-latest
steps:
- name: ->actions/checkout@v4
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: ->actions/setup-node@v4
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: npm
- run: npm install
- name: ->npx changelogithub
run: npx changelogithub
continue-on-error: true
env:
GITHUB_TOKEN: ${{secrets.NUXT_QUICK_RELEASE_TOKEN}}
- name: ->googleapis/release-please-action@v4
uses: googleapis/release-please-action@v4
with:
token: ${{ secrets.NUXT_QUICK_RELEASE_TOKEN }}
release-type: node
# - run: npm ci
# if: ${{ steps.release.outputs.release_created }}
# - run: npm publish
# env:
# NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
# if: ${{ steps.release.outputs.release_created }}
#三、执行流程
- 在 Repository下提交tag
$ git tag v1.0.0
$ git push origin v1.0.0
- Github会自动执行相关Action
- 执行过程:自动生成changelog、发版release
- 执行结果
快速開始
基本框架
功能模块
UI設計
程式碼規範
開發環境
部署
待辦規劃