Skip to content

Commit

Permalink
ci: update github actions workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
nopdan committed Oct 12, 2024
1 parent 77ce938 commit 328b03d
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 163 deletions.
86 changes: 27 additions & 59 deletions .github/workflows/commit.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
name: Commit CI

on:
push:
branches: [master]
on: [push]

jobs:
build-winform:
runs-on: windows-latest
permissions:
contents: write
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

Expand All @@ -18,32 +14,22 @@ jobs:
dotnet-version: "8.0.x"

- name: Restore dependencies
run: dotnet restore "./src/IME WL Converter Win"
run: dotnet restore ./src/ImeWlConverterCmd

- name: Publish
run: dotnet publish --configuration Release --output ./publish "./src/IME WL Converter Win"

- name: Archive Release
run: 7z a -tzip imewlconverter_Windows.zip publish/
run: dotnet publish --configuration Release --output ./publish ./src/ImeWlConverterCmd

- uses: ncipollo/release-action@v1
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
artifacts: "imewlconverter_Windows.zip"
allowUpdates: true
prerelease: true
commit: master
tag: "preview"
name: "Preview"
generateReleaseNotes: true
token: ${{ secrets.GITHUB_TOKEN }}

build-cmd:
name: "imewlconverter_Linux.tar.gz"
path: ./publish

macos:
runs-on: macos-latest
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
permissions:
contents: write
arch: [x64, arm64]
steps:
- uses: actions/checkout@v4

Expand All @@ -56,26 +42,16 @@ jobs:
run: dotnet restore ./src/ImeWlConverterCmd

- name: Publish
run: dotnet publish --configuration Release --output ./publish ./src/ImeWlConverterCmd
run: dotnet publish --configuration Release --output ./publish-${{ matrix.arch }} ./src/ImeWlConverterCmd -a ${{ matrix.arch }}

- name: Archive Release
run: tar -czf imewlconverter_${{ runner.os }}.tar.gz publish/*

- uses: ncipollo/release-action@v1
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
artifacts: "imewlconverter_${{ runner.os }}.tar.gz"
allowUpdates: true
prerelease: true
commit: master
tag: "preview"
name: "Preview"
generateReleaseNotes: true
token: ${{ secrets.GITHUB_TOKEN }}

build-mac-arm64:
runs-on: macos-latest
permissions:
contents: write
name: "imewlconverter_macOS-${{ matrix.arch }}"
path: ./publish-${{ matrix.arch }}

windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4

Expand All @@ -85,21 +61,13 @@ jobs:
dotnet-version: "8.0.x"

- name: Restore dependencies
run: dotnet restore ./src/ImeWlConverterCmd
run: dotnet restore "./src/IME WL Converter Win"

- name: Publish
run: dotnet publish --configuration Release --output ./publish ./src/ImeWlConverterCmd -a arm64

- name: Archive Release
run: tar -czf imewlconverter_${{ runner.os }}-aarch64.tar.gz publish/*
run: dotnet publish --configuration Release --output ./publish "./src/IME WL Converter Win"

- uses: ncipollo/release-action@v1
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
artifacts: "imewlconverter_${{ runner.os }}-aarch64.tar.gz"
allowUpdates: true
prerelease: true
commit: master
tag: "preview"
name: "Preview"
generateReleaseNotes: true
token: ${{ secrets.GITHUB_TOKEN }}
name: imewlconverter_Windows
path: ./publish
55 changes: 0 additions & 55 deletions .github/workflows/pull-request.yml

This file was deleted.

96 changes: 48 additions & 48 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,50 +6,59 @@ on:
- "v*"

jobs:
build-winform:
runs-on: windows-latest
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Generate CHANGELOG
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
tag: ${{ github.ref_name }}
writeToFile: false
includeInvalidCommits: true

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"

- name: Restore dependencies
run: dotnet restore "./src/IME WL Converter Win"
run: dotnet restore ./src/ImeWlConverterCmd

- name: Publish
run: dotnet publish --configuration Release --output ./publish "./src/IME WL Converter Win"

- name: Archive Release
run: 7z a -tzip imewlconverter_Windows.zip publish/
run: dotnet publish --configuration Release --output ./publish ./src/ImeWlConverterCmd

- name: Update CHANGELOG
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
tag: ${{ github.ref_name }}
writeToFile: false
includeInvalidCommits: true
- name: Archive
run: tar -czf imewlconverter_Linux.tar.gz publish/*

- uses: ncipollo/release-action@v1
with:
artifacts: "imewlconverter_Windows.zip"
artifacts: "imewlconverter_Linux.tar.gz"
allowUpdates: true
body: |
${{ steps.changelog.outputs.changes }}
token: ${{ secrets.GITHUB_TOKEN }}

build-cmd:
macos:
runs-on: macos-latest
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
arch: [x64, arm64]
steps:
- uses: actions/checkout@v4

- name: Generate CHANGELOG
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
tag: ${{ github.ref_name }}
writeToFile: false
includeInvalidCommits: true

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
Expand All @@ -59,59 +68,50 @@ jobs:
run: dotnet restore ./src/ImeWlConverterCmd

- name: Publish
run: dotnet publish --configuration Release --output ./publish ./src/ImeWlConverterCmd

- name: Archive Release
run: tar -czf imewlconverter_${{ runner.os }}.tar.gz publish/*
run: dotnet publish --configuration Release --output ./publish-${{ matrix.arch }} ./src/ImeWlConverterCmd -a ${{ matrix.arch }}

- name: Update CHANGELOG
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
tag: ${{ github.ref_name }}
writeToFile: false
includeInvalidCommits: true
- name: Archive
run: tar -czf imewlconverter_macOS-${{ matrix.arch }}.tar.gz publish-${{ matrix.arch }}/*

- uses: ncipollo/release-action@v1
with:
artifacts: "imewlconverter_${{ runner.os }}.tar.gz"
artifacts: "imewlconverter_macOS-${{ matrix.arch }}.tar.gz"
allowUpdates: true
body: |
${{ steps.changelog.outputs.changes }}
token: ${{ secrets.GITHUB_TOKEN }}

build-mac-arm64:
runs-on: macos-latest
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4

- name: Generate CHANGELOG
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
tag: ${{ github.ref_name }}
writeToFile: false
includeInvalidCommits: true

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"

- name: Restore dependencies
run: dotnet restore ./src/ImeWlConverterCmd
run: dotnet restore "./src/IME WL Converter Win"

- name: Publish
run: dotnet publish --configuration Release --output ./publish ./src/ImeWlConverterCmd -a arm64

- name: Archive Release
run: tar -czf imewlconverter_${{ runner.os }}-aarch64.tar.gz publish/*
run: dotnet publish --configuration Release --output ./publish "./src/IME WL Converter Win"

- name: Update CHANGELOG
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
tag: ${{ github.ref_name }}
writeToFile: false
includeInvalidCommits: true
- name: Archive
run: 7z a -tzip imewlconverter_Windows.zip publish/

- uses: ncipollo/release-action@v1
with:
artifacts: "imewlconverter_${{ runner.os }}-aarch64.tar.gz"
artifacts: "imewlconverter_Windows.zip"
allowUpdates: true
body: |
${{ steps.changelog.outputs.changes }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# 深蓝词库转换

[![Stars](https://img.shields.io/github/stars/studyzy/imewlconverter)](https://github.com/studyzy/imewlconverter/stargazers)
![Actions Check](https://github.com/studyzy/imewlconverter/actions/workflows/winform.yml/badge.svg)
![Actions Check](https://github.com/studyzy/imewlconverter/actions/workflows/commit.yml/badge.svg)
![License](https://img.shields.io/github/license/studyzy/imewlconverter)
![Repo size](https://img.shields.io/github/repo-size/studyzy/imewlconverter)
[![Code Count](https://tokei.rs/b1/github/studyzy/imewlconverter)](https://github.com/studyzy/imewlconverter)
Expand Down

0 comments on commit 328b03d

Please sign in to comment.