-
Notifications
You must be signed in to change notification settings - Fork 0
174 lines (148 loc) · 4.85 KB
/
console-release.yml
File metadata and controls
174 lines (148 loc) · 4.85 KB
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
name: console
on:
workflow_dispatch:
inputs:
rel_version:
description: 'Release version (examples: 1.9.0-rc.1, 1.9.1)'
required: true
type: string
env:
DOCKER_USER_NAME: ${{ github.repository_owner }}
DOCKER_IMAGE_NAME: ${{ github.event.repository.name }}
defaults:
run:
shell: bash
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os_arch: [x64, arm, arm64]
include:
- os: ubuntu-latest
kind: linux
title: linux
- os: windows-latest
kind: win
title: windows
- os: macos-latest
kind: osx
title: osx
exclude:
- os: windows-latest
os_arch: arm
- os: macos-latest
os_arch: arm
runs-on: ${{ matrix.os }}
env:
ARCHIVE_OUTDIR: dist/archives
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.9.7
with:
versionSpec: 5.x
- name: Determine Version
uses: gittools/actions/gitversion/execute@v0.9.7
id: gitversion
- name: Display GitVersion outputs
run: |
echo "Version: ${{ inputs.rel_version }}"
- name: Setup .NET
uses: actions/setup-dotnet@v3.2.0
with:
dotnet-version: 9.0.x
- name: Publish
run: |
release_name="console-${{ matrix.title }}-${{ matrix.os_arch }}"
dotnet publish src/Console.csproj \
-p:PublishSingleFile=true \
-p:PublishReadyToRun=true \
--runtime "${{ matrix.kind }}-${{ matrix.os_arch }}" \
-c Release --self-contained true \
-p:Version="${{ inputs.rel_version }}" \
-o "${{ github.workspace }}/$release_name"
mkdir -p "${{ github.workspace }}/dist"
cd "${{ github.workspace }}/$release_name"
if [[ "${{ matrix.kind }}" == "win" ]]; then
7z a -tzip "${{ github.workspace }}/dist/${release_name}.zip" *
else
tar czvf "${{ github.workspace }}/dist/${release_name}.tar.gz" *
fi
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: console-${{ matrix.title }}-${{ matrix.os_arch }}
path: "${{ github.workspace }}/dist"
release:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/master'
env:
ARTIFACT_DIR: ./release
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: console-*
path: ${{ env.ARTIFACT_DIR }}
merge-multiple: true
- name: Generate checksums
run: |
cd ${ARTIFACT_DIR}
for i in *; do sha256sum -b "$i" > "$i.sha256"; done
- name: Create Release
uses: ncipollo/release-action@v1
with:
tag: v${{ inputs.rel_version }}
name: Console v${{ inputs.rel_version }}
body: "This is the v${{ inputs.rel_version }} release of FlowSynx Console"
artifacts: "**/*.*"
token: ${{ secrets.GH_TOKEN }}
- name: Create Branch
uses: peterjgrainger/action-create-branch@v2.2.0
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
branch: release-${{ inputs.rel_version }}
sha: ${{ github.event.pull_request.head.sha }}
compute:
runs-on: ubuntu-latest
outputs:
docker_user_name: ${{ env.DOCKER_USER_NAME }}
docker_image_name: ${{ env.DOCKER_IMAGE_NAME }}
steps:
- name: Compute Outputs
run: |
echo "docker_user_name=${{ env.DOCKER_USER_NAME }}" >> $GITHUB_OUTPUT
echo "docker_image_name=${{ env.DOCKER_IMAGE_NAME }}" >> $GITHUB_OUTPUT
docker:
strategy:
matrix:
os: [ubuntu-latest, windows-2022]
include:
- os: ubuntu-latest
file: docker/Dockerfile.Linux
tag_suffix: linux-amd64
- os: windows-2022
file: docker/Dockerfile.Windows
tag_suffix: windows-ltsc2022-amd64
runs-on: ${{ matrix.os }}
needs: [compute, build, release]
steps:
- uses: actions/checkout@v4
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and Push Image
run: |
IMAGE_NAME=${{ needs.compute.outputs.docker_user_name }}/${{ needs.compute.outputs.docker_image_name }}
TAG="${IMAGE_NAME}:${{ inputs.rel_version }}-${{ matrix.tag_suffix }}"
docker build -f ${{ matrix.file }} \
--build-arg APP_VERSION=${{ inputs.rel_version }} \
-t $TAG .
docker push $TAG