GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add workflow to cut releases · netty/netty-tcnative@578e477

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .github
    • scripts
      • merge_local_staging.sh
      • release_checkout_tag.sh
      • release_rollback.ps1
      • release_rollback.sh
    • workflows
      • ci-release.yml
  • docker
    • docker-compose.centos-6.18.yaml
    • docker-compose.centos-6.yaml
    • docker-compose.centos-7.yaml
    • docker-compose.debian-7.18.yaml
    • docker-compose.debian.yaml
  • pom.xml
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.github/scripts/merge_local_staging.sh‎

Copy file name to clipboard
+20Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
set -e
3+
if [ "$#" -lt 2 ]; then
4+
echo "Expected target directory and at least one local staging directory"
5+
exit 1
6+
fi
7+
TARGET=$1
8+
9+
for ((i=2; i<=$#; i++))
10+
do
11+
DIR="${!i}"
12+
SUB_DIR=$(ls -d "${DIR}"/* | awk -F / '{print $NF}')
13+
14+
if [ ! -d "${TARGET}/${SUB_DIR}" ]
15+
then
16+
mkdir -p "${TARGET}/${SUB_DIR}"
17+
fi
18+
cat "${DIR}"/"${SUB_DIR}"/.index >> "${TARGET}/${SUB_DIR}"/.index
19+
cp -r "${DIR}"/"${SUB_DIR}"/* "${TARGET}/${SUB_DIR}"/
20+
done
Collapse file

‎.github/scripts/release_checkout_tag.sh‎

Copy file name to clipboard
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
set -e
3+
4+
if [ "$#" -ne 1 ]; then
5+
echo "Expected release.properties file"
6+
exit 1
7+
fi
8+
9+
TAG=$(grep scm.tag= "$1" | cut -d'=' -f2)
10+
11+
echo "Checkout tag $TAG"
12+
git checkout "$TAG"
13+
exit 0
Collapse file

‎.github/scripts/release_rollback.ps1‎

Copy file name to clipboard
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
$file=$args[0]
2+
$repository=$args[1]
3+
$branch=$args[2]
4+
$line = Select-String -Path $file -Pattern "scm.tag="
5+
$tag = ($line -split "=")[1]
6+
$url = "[email protected]:" + $repository + ".git"
7+
git remote set-url origin $url
8+
git fetch
9+
git checkout $branch
10+
mvn -B --file pom.xml release:rollback
11+
git push origin :$tag
Collapse file

‎.github/scripts/release_rollback.sh‎

Copy file name to clipboard
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
set -e
3+
4+
if [ "$#" -ne 3 ]; then
5+
echo "Expected release.properties file, repository name and branch"
6+
exit 1
7+
fi
8+
9+
TAG=$(grep scm.tag= "$1" | cut -d'=' -f2)
10+
git remote set-url origin [email protected]:"$2".git
11+
git fetch
12+
git checkout "$3"
13+
mvn -B --file pom.xml release:rollback
14+
git push origin :"$TAG"
Collapse file

‎.github/workflows/ci-release.yml‎

Copy file name to clipboard
+306Lines changed: 306 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,306 @@
1+
name: Release
2+
3+
on:
4+
5+
# Releases can only be triggered via the action tab
6+
workflow_dispatch:
7+
8+
jobs:
9+
prepare-release:
10+
runs-on: ubuntu-18.04
11+
steps:
12+
- uses: actions/checkout@v2
13+
with:
14+
ref: main
15+
16+
- name: Set up JDK 8
17+
uses: actions/setup-java@v1
18+
with:
19+
java-version: 8
20+
21+
- name: Setup git configuration
22+
run: |
23+
git config --global user.email "[email protected]"
24+
git config --global user.name "Netty Project Bot"
25+
26+
- name: Install SSH key
27+
uses: shimataro/ssh-key-action@v2
28+
with:
29+
key: ${{ secrets.SSH_PRIVATE_KEY_PEM }}
30+
known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
31+
32+
# Cache .m2/repository
33+
- uses: actions/cache@v2
34+
env:
35+
cache-name: release-cache-m2-repository
36+
with:
37+
path: ~/.m2/repository
38+
key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
39+
restore-keys: |
40+
${{ runner.os }}-pr-${{ env.cache-name }}-
41+
${{ runner.os }}-pr-
42+
43+
- name: Prepare release with Maven
44+
run: |
45+
mvn -DpreparationGoals=clean release:prepare -B --file pom.xml -DskipTests=true
46+
mvn clean
47+
48+
- name: Checkout tag
49+
run: ./.github/scripts/release_checkout_tag.sh release.properties
50+
51+
- name: Upload workspace
52+
uses: actions/upload-artifact@v2
53+
with:
54+
name: prepare-release-workspace
55+
path: ${{ github.workspace }}/**
56+
57+
stage-release-linux:
58+
runs-on: ubuntu-latest
59+
needs: prepare-release
60+
strategy:
61+
matrix:
62+
include:
63+
- setup: centos6-x86_64
64+
docker-compose-build: "-f docker/docker-compose.centos-6.yaml -f docker/docker-compose.centos-6.18.yaml build"
65+
docker-compose-run: "-f docker/docker-compose.centos-6.yaml -f docker/docker-compose.centos-6.18.yaml run stage-release"
66+
- setup: debian7-x86_64
67+
docker-compose-build: "-f docker/docker-compose.debian.yaml -f docker/docker-compose.debian-7.18.yaml build"
68+
docker-compose-run: "-f docker/docker-compose.debian.yaml -f docker/docker-compose.debian-7.18.yaml run stage-release"
69+
- setup: centos7-aarch64
70+
docker-compose-build: "-f docker/docker-compose.centos-7.yaml build"
71+
docker-compose-run: "-f docker/docker-compose.centos-7.yaml run cross-compile-aarch64-stage-release"
72+
73+
name: stage-release-${{ matrix.setup }}
74+
75+
steps:
76+
- name: Download release-workspace
77+
uses: actions/download-artifact@v2
78+
with:
79+
name: prepare-release-workspace
80+
path: ./prepare-release-workspace/
81+
82+
- name: Set up JDK 8
83+
uses: actions/setup-java@v1
84+
with:
85+
java-version: 8
86+
87+
- name: Setup git configuration
88+
run: |
89+
git config --global user.email "[email protected]"
90+
git config --global user.name "Netty Project Bot"
91+
92+
- name: Install SSH key
93+
uses: shimataro/ssh-key-action@v2
94+
with:
95+
key: ${{ secrets.SSH_PRIVATE_KEY_PEM }}
96+
known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
97+
98+
# Enable caching of Docker layers
99+
- uses: satackey/[email protected]
100+
env:
101+
docker-cache-name: staging-${{ matrix.setup }}-cache-docker
102+
continue-on-error: true
103+
with:
104+
key: ${{ runner.os }}-staging-${{ env.docker-cache-name }}-{hash}
105+
restore-keys: |
106+
${{ runner.os }}-staging-${{ env.docker-cache-name }}-
107+
108+
- uses: s4u/[email protected]
109+
with:
110+
servers: |
111+
[{
112+
"id": "sonatype-nexus-staging",
113+
"username": "${{ secrets.SONATYPE_USERNAME }}",
114+
"password": "${{ secrets.SONATYPE_PASSWORD }}"
115+
}]
116+
117+
- name: Create local staging directory
118+
run: mkdir -p ~/local-staging
119+
120+
- name: Build docker image
121+
working-directory: ./prepare-release-workspace/
122+
run: docker-compose ${{ matrix.docker-compose-build }}
123+
124+
- name: Stage release to local staging directory
125+
working-directory: ./prepare-release-workspace/
126+
env:
127+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
128+
GPG_KEYNAME: ${{ secrets.GPG_KEYNAME }}
129+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
130+
run: docker-compose ${{ matrix.docker-compose-run }}
131+
132+
- name: Upload local staging directory
133+
uses: actions/upload-artifact@v2
134+
with:
135+
name: ${{ matrix.setup }}-local-staging
136+
path: ~/local-staging
137+
if-no-files-found: error
138+
139+
- name: Rollback release on failure
140+
working-directory: ./prepare-release-workspace/
141+
if: ${{ failure() }}
142+
# Rollback the release in case of an failure
143+
run: bash ./.github/scripts/release_rollback.sh release.properties netty/netty-tcnative main
144+
145+
stage-release-windows-x86_64:
146+
runs-on: windows-2016
147+
name: stage-release-windows-x86_64
148+
needs: prepare-release
149+
steps:
150+
- name: Download release-workspace
151+
uses: actions/download-artifact@v2
152+
with:
153+
name: prepare-release-workspace
154+
path: prepare-release-workspace
155+
156+
- name: Setup git configuration
157+
run: |
158+
git config --global user.email "[email protected]"
159+
git config --global user.name "Netty Project Bot"
160+
161+
- name: Install SSH key
162+
uses: shimataro/ssh-key-action@v2
163+
with:
164+
key: ${{ secrets.SSH_PRIVATE_KEY_PEM }}
165+
known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
166+
167+
- name: Set up JDK 8
168+
uses: actions/setup-java@v1
169+
with:
170+
java-version: 8
171+
172+
- name: Add msbuild to PATH
173+
uses: microsoft/[email protected]
174+
175+
- name: Configuring Developer Command Prompt
176+
uses: ilammy/msvc-dev-cmd@v1
177+
with:
178+
arch: x86_amd64
179+
180+
- name: Import GPG key
181+
id: import_gpg
182+
uses: crazy-max/ghaction-import-gpg@v3
183+
with:
184+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
185+
passphrase: ${{ secrets.GPG_PASSPHRASE }}
186+
187+
- name: Install tools
188+
uses: crazy-max/ghaction-chocolatey@v1
189+
with:
190+
args: install ninja nasm
191+
192+
# Cache .m2/repository
193+
- uses: actions/cache@v2
194+
env:
195+
cache-name: staging-release-cache-windows-m2-repository
196+
with:
197+
path: ~/.m2/repository
198+
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
199+
restore-keys: |
200+
${{ runner.os }}-${{ env.cache-name }}-
201+
${{ runner.os }}-
202+
203+
- uses: s4u/[email protected]
204+
with:
205+
servers: |
206+
[{
207+
"id": "sonatype-nexus-staging",
208+
"username": "${{ secrets.SONATYPE_USERNAME }}",
209+
"password": "${{ secrets.SONATYPE_PASSWORD }}"
210+
}]
211+
212+
- name: Stage release to local staging directory
213+
working-directory: prepare-release-workspace
214+
run: mvn --file pom.xml -Pstage -pl boringssl-static clean javadoc:jar package gpg:sign org.sonatype.plugins:nexus-staging-maven-plugin:deploy -DnexusUrl=https://oss.sonatype.org -DserverId=sonatype-nexus-staging -DaltStagingDirectory=local-staging -DskipRemoteStaging=true -DskipTests=true -D'checkstyle.skip=true'
215+
216+
- name: Upload local staging directory
217+
uses: actions/upload-artifact@v2
218+
with:
219+
name: windows-x86_64-local-staging
220+
path: prepare-release-workspace/boringssl-static/local-staging
221+
if-no-files-found: error
222+
223+
- name: Rollback release on failure
224+
working-directory: prepare-release-workspace
225+
if: ${{ failure() }}
226+
# Rollback the release in case of an failure
227+
run: ./.github/scripts/release_rollback.ps1 release.properties netty/netty-tcnative main
228+
229+
deploy-staged-release:
230+
runs-on: ubuntu-18.04
231+
# Wait until we have staged everything
232+
needs: [stage-release-linux, stage-release-windows-x86_64]
233+
steps:
234+
- name: Download release-workspace
235+
uses: actions/download-artifact@v2
236+
with:
237+
name: prepare-release-workspace
238+
path: ./prepare-release-workspace/
239+
240+
- name: Set up JDK 8
241+
uses: actions/setup-java@v1
242+
with:
243+
java-version: 8
244+
245+
- name: Setup git configuration
246+
run: |
247+
git config --global user.email "[email protected]"
248+
git config --global user.name "Netty Project Bot"
249+
250+
- name: Install SSH key
251+
uses: shimataro/ssh-key-action@v2
252+
with:
253+
key: ${{ secrets.SSH_PRIVATE_KEY_PEM }}
254+
known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
255+
256+
# Hardcode the staging artifacts that need to be downloaded.
257+
# These must match the matrix setups. There is currently no way to pull this out of the config.
258+
- name: Download windows-x86_64 staging directory
259+
uses: actions/download-artifact@v2
260+
with:
261+
name: windows-x86_64-local-staging
262+
path: ~/windows-x86_64-local-staging
263+
264+
- name: Download centos7-aarch64 staging directory
265+
uses: actions/download-artifact@v2
266+
with:
267+
name: centos7-aarch64-local-staging
268+
path: ~/centos7-aarch64-local-staging
269+
270+
- name: Download debian7-x86_64 staging directory
271+
uses: actions/download-artifact@v2
272+
with:
273+
name: debian7-x86_64-local-staging
274+
path: ~/debian7-x86_64-local-staging
275+
276+
- name: Download centos6-x86_64 staging directory
277+
uses: actions/download-artifact@v2
278+
with:
279+
name: centos6-x86_64-local-staging
280+
path: ~/centos6-x86_64-local-staging
281+
282+
# This step takes care of merging all the previous staged repositories in a way that will allow us to deploy
283+
# all together with one maven command.
284+
- name: Merge staging repositories
285+
working-directory: ./prepare-release-workspace/
286+
run: bash ./.github/scripts/merge_local_staging.sh /home/runner/local-staging/staging ~/windows-x86_64-local-staging/staging ~/centos7-aarch64-local-staging/staging ~/debian7-x86_64-local-staging/staging ~/centos6-x86_64-local-staging/staging
287+
288+
- uses: s4u/[email protected]
289+
with:
290+
servers: |
291+
[{
292+
"id": "sonatype-nexus-staging",
293+
"username": "${{ secrets.SONATYPE_USERNAME }}",
294+
"password": "${{ secrets.SONATYPE_PASSWORD }}"
295+
}]
296+
297+
- name: Deploy local staged artifacts
298+
working-directory: ./prepare-release-workspace/
299+
# If we don't want to close the repository we can add -DskipStagingRepositoryClose=true
300+
run: mvn -B --file pom.xml org.sonatype.plugins:nexus-staging-maven-plugin:deploy-staged -DnexusUrl=https://oss.sonatype.org -DserverId=sonatype-nexus-staging -DaltStagingDirectory=/home/runner/local-staging -DskipStagingRepositoryClose=true
301+
302+
- name: Rollback release on failure
303+
working-directory: ./prepare-release-workspace/
304+
if: ${{ failure() }}
305+
# Rollback the release in case of an failure
306+
run: bash ./.github/scripts/release_rollback.sh release.properties netty/netty-tcnative main
Collapse file

‎docker/docker-compose.centos-6.18.yaml‎

Copy file name to clipboardExpand all lines: docker/docker-compose.centos-6.18.yaml
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,8 @@ services:
2121
stage-snapshot:
2222
image: netty-tcnative-centos:centos-6-1.8
2323

24+
stage-release:
25+
image: netty-tcnative-centos:centos-6-1.8
26+
2427
shell:
2528
image: netty-tcnative-centos:centos-6-1.8
Collapse file

‎docker/docker-compose.centos-6.yaml‎

Copy file name to clipboardExpand all lines: docker/docker-compose.centos-6.yaml
+14-1Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,20 @@ services:
3232
- ~/.gnupg:/root/.gnupg
3333
- ~/local-staging:/root/local-staging
3434
- ..:/code
35-
command: /bin/bash -cl "mvn clean package org.sonatype.plugins:nexus-staging-maven-plugin:deploy -DaltStagingDirectory=/root/local-staging -DskipRemoteStaging=true -DskipTests=true"
35+
command: /bin/bash -cl "mvn -Pstage -pl openssl-dynamic,boringssl-static clean package org.sonatype.plugins:nexus-staging-maven-plugin:deploy -DaltStagingDirectory=/root/local-staging -DskipRemoteStaging=true -DskipTests=true"
36+
37+
stage-release:
38+
<<: *common
39+
environment:
40+
- GPG_KEYNAME
41+
- GPG_PASSPHRASE
42+
- GPG_PRIVATE_KEY
43+
volumes:
44+
- ~/.ssh:/root/.ssh
45+
- ~/.m2/settings.xml:/root/.m2/settings.xml
46+
- ~/local-staging:/root/local-staging
47+
- ..:/code
48+
command: /bin/bash -cl "cat <(echo -e \"${GPG_PRIVATE_KEY}\") | gpg --batch --import && mvn -B -Pstage -pl openssl-dynamic,boringssl-static clean javadoc:jar package gpg:sign org.sonatype.plugins:nexus-staging-maven-plugin:deploy -DnexusUrl=https://oss.sonatype.org -DserverId=sonatype-nexus-staging -DaltStagingDirectory=/root/local-staging -DskipRemoteStaging=true -DskipTests=true -Dgpg.passphrase=${GPG_PASSPHRASE} -Dgpg.keyname=${GPG_KEYNAME}"
3649

3750
deploy:
3851
<<: *common

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.