test ci #20
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: make | |
on: | |
push: | |
branches: | |
- 'main' | |
workflow_dispatch: | |
env: | |
VERSION: 1.0.${{ github.run_number }} # 动态版本号,基于当前工作流运行次数 | |
jobs: | |
linux: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set version | |
run: | | |
sed -i "s/\"version\": \".*\"/\"version\": \"$VERSION\"/" package.json | |
- name: Install dependencies with Yarn | |
run: yarn install | |
- name: Build for Linux | |
run: | | |
yarn make | |
- name: Upload Linux Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: linux-${{ env.VERSION }} | |
path: out/make | |
windows: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set version | |
run: | | |
powershell -Command "(gc .\package.json) -replace '0.0.0', '$($env:VERSION)' | Set-Content .\package.json" | |
- name: Install dependencies with Yarn | |
run: yarn install | |
- name: Build for Windows | |
run: yarn make | |
- name: Upload Windows Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: windows-${{ env.VERSION }} | |
path: out/make | |
macos: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set version | |
run: | | |
sed -i '' "s/\"version\": \".*\"/\"version\": \"$VERSION\"/" package.json | |
- name: Install dependencies with Yarn | |
run: yarn install | |
- name: Build for macOS | |
run: yarn make | |
- name: Upload macOS Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: macos-${{ env.VERSION }} | |
path: out/make | |
release: | |
needs: [linux, windows, macos] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Artifact | |
uses: actions/download-artifact@v4 | |
- name: GH Release | |
uses: softprops/[email protected] | |
with: | |
files: | | |
macos-${{ env.VERSION }}.zip | |
windows-${{ env.VERSION }}.zip | |
linux-${{ env.VERSION }}.zip | |
tag_name: ${{ env.VERSION }} | |
- name: ls -al | |
run: | | |
ls -al | |
cd linux-${{ env.VERSION }} | |
ls -al | |
cd ../macos-${{ env.VERSION }} | |
ls -al | |
cd ../windows-${{ env.VERSION }} | |
ls -al | |
# - name: Upload Linux Asset | |
# uses: actions/upload-release-asset@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# with: | |
# upload_url: ${{ steps.create_release.outputs.upload_url }} | |
# asset_path: dist/linux | |
# asset_name: linux.zip | |
# asset_content_type: application/zip | |
# - name: Upload Windows Asset | |
# uses: actions/upload-release-asset@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# with: | |
# upload_url: ${{ steps.create_release.outputs.upload_url }} | |
# asset_path: dist/windows | |
# asset_name: windows.zip | |
# asset_content_type: application/zip | |
# - name: Upload macOS Asset | |
# uses: actions/upload-release-asset@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# with: | |
# upload_url: ${{ steps.create_release.outputs.upload_url }} | |
# asset_path: dist/macos | |
# asset_name: macos.zip | |
# asset_content_type: application/zip |