Repository navigation
173 lines (169 loc) · 5.9 KB
/
Copy pathrelease.yml
File metadata and controls
173 lines (169 loc) · 5.9 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
name: Release
on:
push:
tags: [ RELEASE_* ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
jobs:
version:
name: Determine Release Version
runs-on: ubuntu-latest
timeout-minutes: 10
defaults:
run:
shell: bash
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Determine release version
id: version
run: |
if echo "${{ github.ref }}" | grep -E "^refs/tags/RELEASE_[0-9]+\.[0-9]+$" > /dev/null; then
echo "version=$(echo "${{ github.ref }}" | sed -E "s|^refs/tags/RELEASE_([0-9]+\.[0-9]+)$|\1|")" >> "$GITHUB_OUTPUT"
else
false
fi
src:
name: Build Source Package
needs:
- version
runs-on: ubuntu-latest
timeout-minutes: 10
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v6
- name: Install dependencies
run: |
sudo apt-get -y update
sudo apt-get -y install autoconf automake
- name: Create package
run: |
autoreconf -f -i -Wall,error
./configure
sudo make distcheck "CFLAGS=-Werror"
- uses: actions/upload-artifact@v7
with:
name: package-src
path: bwping-${{ needs.version.outputs.version }}.tar.gz
if-no-files-found: error
retention-days: 1
cygwin:
name: Build Cygwin Package
needs:
- version
runs-on: windows-latest
timeout-minutes: 10
defaults:
run:
shell: cmd
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install dependencies
run: |
choco.exe install cygwin cyg-get zip unzip -y && ^
cyg-get.bat autoconf automake make gcc-core git
- name: Fix Git settings
run: |
C:\tools\cygwin\bin\bash.exe -l -eo pipefail -c ^"^
cd ""$GITHUB_WORKSPACE""; ^
git config --global --add safe.directory ""$(pwd)""^"
- name: Fix line endings
run: |
C:\tools\cygwin\bin\bash.exe -l -eo pipefail -c ^"^
cd ""$GITHUB_WORKSPACE""; ^
git ls-files -z ^| xargs -0 rm; ^
git checkout -f .^"
- name: Run build
run: |
C:\tools\cygwin\bin\bash.exe -l -eo pipefail -c ^"^
cd ""$GITHUB_WORKSPACE""; ^
autoreconf -f -i -Wall,error; ^
./configure; ^
make ""CFLAGS=-Werror""^"
- name: Run checks
run: |
C:\tools\cygwin\bin\bash.exe -l -eo pipefail -c ^"^
cd ""$GITHUB_WORKSPACE""; ^
make check^"
- name: Prepare license files
run: |
mkdir .licenses && ^
copy /Y /B COPYING .licenses\LICENSE && ^
C:\msys64\usr\bin\wget.exe -O .licenses/COPYING https://cygwin.org/COPYING && ^
C:\msys64\usr\bin\wget.exe -O .licenses/COPYING.LIB https://cygwin.org/COPYING.LIB
- name: Prepare Cygwin build instructions
shell: bash
run: |
cat >> .licenses/CYGWIN_BUILD << EOF
If you want to build Cygwin yourself from source, please follow the instructions at
https://cygwin.com/faq.html#faq.programming.building-cygwin
EOF
- name: Create package
shell: bash
run: |
OUTPUT="$(zip.exe -j "bwping-${{ needs.version.outputs.version }}-win64.zip" .licenses\\COPYING .licenses\\COPYING.LIB .licenses\\CYGWIN_BUILD \
.licenses\\LICENSE AUTHORS bwping.exe C:\\tools\\cygwin\\bin\\cygwin1.dll \
C:\\tools\\cygwin\\usr\\share\\doc\\Cygwin\\CYGWIN_LICENSE README 2>&1)"
[[ "$(echo "$OUTPUT" | grep -E -v "^\s*adding: ")" == "" ]] || ( echo "$OUTPUT" && false )
- name: Verify package
shell: bash
run: |
unzip.exe "bwping-${{ needs.version.outputs.version }}-win64.zip" -d .package
OUTPUT="$(cmd.exe //c "set PATH= & .package\\bwping.exe" 2>&1 || true)"
[[ "$(echo "$OUTPUT" | grep -v "^bwping is part of the " | grep -v "^Usage: ")" == "" ]] || ( echo "$OUTPUT" && false )
- uses: actions/upload-artifact@v7
with:
name: package-cygwin
path: bwping-${{ needs.version.outputs.version }}-win64.zip
if-no-files-found: error
retention-days: 1
upload:
name: Upload Packages
needs:
- version
- src
- cygwin
runs-on: ubuntu-latest
timeout-minutes: 10
defaults:
run:
shell: bash
steps:
- name: Download source package artifact
uses: actions/download-artifact@v8
with:
name: package-src
- name: Download Cygwin package artifact
uses: actions/download-artifact@v8
with:
name: package-cygwin
- name: Upload packages to GitHub
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifactErrorsFailBuild: true
artifacts: bwping-${{ needs.version.outputs.version }}.tar.gz, bwping-${{ needs.version.outputs.version }}-win64.zip
draft: true
name: BWPing ${{ needs.version.outputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload packages to SourceForge
env:
SF_PRIVATE_KEY: ${{ secrets.SF_PRIVATE_KEY }}
run: |
eval "$(ssh-agent)"
echo "$SF_PRIVATE_KEY" | ssh-add -
mkdir -p ~/.ssh
echo "frs.sourceforge.net ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOQD35Ujalhh+JJkPvMckDlhu4dS7WH6NsOJ15iGCJLC" >> ~/.ssh/known_hosts
sftp -b - oleg_derevenetz@frs.sourceforge.net << EOF
mkdir /home/frs/project/bwping/bwping/${{ needs.version.outputs.version }}
cd /home/frs/project/bwping/bwping/${{ needs.version.outputs.version }}
put bwping-${{ needs.version.outputs.version }}.tar.gz
cd /home/frs/project/bwping/ports/win64
put bwping-${{ needs.version.outputs.version }}-win64.zip
EOF