forked from Scighost/Starward
-
Notifications
You must be signed in to change notification settings - Fork 1
110 lines (86 loc) · 3.05 KB
/
publish_dev.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
103
104
105
106
107
108
109
110
name: Publish Dev
on:
workflow_dispatch:
permissions:
pull-requests: write
contents: write
jobs:
version:
runs-on: windows-latest
outputs:
version: ${{ steps.generate_version.outputs.version }}
steps:
- name: Generate Version
id: generate_version
run: |
$id = (Get-Date).ToString('yyMMddHHmm')
$version = "0.0.1-dev.$id"
echo "version=$version" >> $env:GITHUB_OUTPUT
build:
runs-on: windows-latest
needs: version
outputs:
version: ${{ needs.version.outputs.version }}
strategy:
matrix:
platform: [x64, arm64]
env:
Platform: ${{ matrix.platform }}
Version: ${{ needs.version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
global-json-file: global.json
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Build
run: ./build.ps1 -Architecture $env:Platform -Version $env:Version -Dev
- name: Metadata
run: ./metadata.ps1 -Architecture $env:Platform -Version $env:Version -Dev
- name: Setup OssUtil
run: |
Invoke-WebRequest https://gosspublic.alicdn.com/ossutil/1.7.15/ossutil-v1.7.15-windows-amd64.zip -OutFile ${{runner.temp}}/ossutil.zip
Expand-Archive -Path ${{runner.temp}}/ossutil.zip -DestinationPath ${{runner.temp}}
Move-Item -Path ${{runner.temp}}/ossutil-v1.7.15-windows-amd64/ossutil64.exe -Destination C:/Windows/System32/ossutil.exe -Force
ossutil config -e ${{ secrets.OSS_ENDPOINT }} -i ${{ secrets.ACCESS_KEY_ID }} -k ${{ secrets.ACCESS_KEY_SECRET }}
- name: Upload to OSS
run: ossutil cp -rf ./build/release/ oss://starward/release/ --meta Content-Type:multipart/mixed
- name: Upload Artifact
uses: actions/[email protected]
with:
name: metadata_${{ matrix.platform }}
path: build/metadata/
metadata:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout Metadata
uses: actions/checkout@v3
with:
ref: metadata
- name: Download Artifact x64
uses: actions/[email protected]
with:
name: metadata_x64
- name: Download Artifact arm64
uses: actions/[email protected]
with:
name: metadata_arm64
- name: Push Metadata
shell: pwsh
run: |
$shortSha = "${{ github.sha }}".Substring(0, 7)
git config --global user.name '${{ github.actor }}'
git config --global user.email '${{ github.actor }}@users.noreply.github.com'
git commit -am "update metadata ${{ needs.build.outputs.version }} ($shortSha)"
git push
- name: Upload to OSS
run: |
rm -rf ./.git ./.github
curl https://gosspublic.alicdn.com/ossutil/install.sh | sudo bash
ossutil config -e ${{ secrets.OSS_ENDPOINT }} -i ${{ secrets.ACCESS_KEY_ID }} -k ${{ secrets.ACCESS_KEY_SECRET }}
ossutil cp -rf ./ oss://starward/metadata/