-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (89 loc) · 3.13 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Release
on:
push:
tags:
- 'v*.*.*'
# pull_request:
# branches:
# - 'master'
workflow_dispatch:
jobs:
publish:
runs-on: [windows-latest]
permissions:
contents: write
discussions: write
strategy:
matrix:
architecture:
- win-x64
- win-arm64
- linux-x64
- linux-arm64
env:
release: 'fnorm-${{ github.ref_name }}-${{ matrix.architecture }}'
release-directory: '${{ github.workspace }}/pub/${{ matrix.architecture }}'
archive-directory: '${{ github.workspace }}/archives'
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Create an archive directory
run: mkdir -p ${{ env.archive-directory }}
- name: Publish ${{ matrix.architecture }} (Windows)
if: matrix.architecture == 'win-x64' || matrix.architecture == 'win-arm64'
run: dotnet publish ./src/FixNormalization -c Release -o ${{ env.release-directory }} -r ${{ matrix.architecture }} --no-self-contained -v normal
- name: Publish ${{ matrix.architecture }} (Others)
if: matrix.architecture != 'win-x64' && matrix.architecture != 'win-arm64'
run: dotnet publish ./src/FixNormalization -c Release -o ${{ env.release-directory }} -r ${{ matrix.architecture }} --self-contained -v normal
- name: Remove Unnecessary Files
run: |
pushd
cd ${{ github.workspace }}/pub/${{ matrix.architecture }}
Get-ChildItem -Filter *.pdb | Remove-Item -Force
Get-ChildItem -Filter *.deps.json -Recurse | Remove-Item
popd
- name: Copy README and LICENSE
run: cp ${{ github.workspace }}/README.md ${{ env.release-directory }} && cp ${{ github.workspace }}/LICENSE ${{ env.release-directory }}
- name: Create Archives
uses: thedoctor0/[email protected]
with:
type: 'zip'
filename: '${{ env.release }}.zip'
directory: ${{ env.archive-directory }}
path: ${{ env.release-directory }}
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.release }}-binary
path: ${{ env.archive-directory }}/${{ env.release }}.zip
overwrite: true
create-release:
name: Create Release on GitHub
needs: [publish]
runs-on: ubuntu-latest
permissions:
contents: write
discussions: write
env:
blobs: '${{ github.workspace }}/blobs'
steps:
- uses: actions/checkout@v4
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
pattern: '*-binary'
path: ${{ env.blobs }}
merge-multiple: true
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
token: ${{ secrets.GITHUB_TOKEN }}
files: |
${{ env.blobs }}/*
make_latest: ${{ !contains(github.ref_name, '-') }}
prerelease: ${{ contains(github.ref_name, '-') }}