Merge remote-tracking branch 'origin/master' #11
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Release | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '1.23.2' | |
- name: Install Go dependencies | |
run: | | |
cd rclone-go | |
go mod tidy | |
go mod vendor | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20.15.0' | |
- name: Install Node.js dependencies | |
run: | | |
cd rclone-web | |
npm install | |
- name: Build frontend | |
run: | | |
cd rclone-web | |
npm run build | |
- name: Build Go backend | |
run: | | |
cd rclone-go | |
go build -o app | |
- name: Package application | |
run: | | |
mkdir -p release/myapp | |
cp -r rclone-web/dist/* release/myapp | |
cp rclone-go/app release/myapp/ | |
VERSION=${GITHUB_REF#refs/tags/} | |
tar -czvf release/rclone-backup-web-${VERSION}.tar.gz -C release myapp | |
- name: List Release Directory | |
run: | | |
ls -la release | |
- name: Upload release assets | |
uses: actions/upload-artifact@v3 | |
with: | |
name: release-assets | |
path: release/rclone-backup-web-*.tar.gz | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: List Release Directory | |
run: | | |
ls -la release # 列出 release 目录中的文件,帮助确认路径是否正确 | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: ${{ github.workspace }}/release/rclone-backup-web-*.tar.gz # 确保引用文件路径正确 | |
tag_name: ${{ github.ref }} # 使用触发事件的标签作为 release 标签 | |
token: ${{ secrets.MY_PERSONAL_ACCESS_TOKEN }} # 确保正确引用 |