forked from babelfish-for-postgresql/babelfish_compass
-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (72 loc) · 2.78 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
# This workflow will publish the release artifacts.
name: Release
on:
push:
tags:
- 'v*'
permissions:
actions: write
contents: write
deployments: write
packages: write
pull-requests: write
repository-projects: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
cache: maven
- name: Build with Maven
run: |
mvn -B package --file pom.xml
- name: Set version env variable
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: 'Install GPG Secret Key'
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v4
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Package up release files
run: |
mkdir BabelfishCompass
cp BabelfishCompass.bat BabelfishCompass/
cp BabelfishFeatures.cfg BabelfishCompass/
cp THIRD-PARTY-LICENSES.txt BabelfishCompass/
cp target/compass-*-jar-with-dependencies.jar BabelfishCompass/
cp LICENSE BabelfishCompass/
cp NOTICE BabelfishCompass/
chmod +x BabelfishCompass.sh
cp BabelfishCompass.sh BabelfishCompass/
mv BabelfishCompass/compass-*-jar-with-dependencies.jar BabelfishCompass/compass.jar
export GPG_TTY=$(tty)
KEYGRIP="$(gpg --with-keygrip -K | grep -Pom1 '^ *Keygrip += +\K.*')"
/usr/lib/gnupg2/gpg-preset-passphrase -c "$KEYGRIP" <<< "${{ secrets.GPG_PASSPHRASE }}"
for jar in BabelfishCompass/*.jar; do gpg --detach-sign --armor $jar; done
for signed in BabelfishCompass/*.asc; do gpg --verify $signed; done
zip -r BabelfishCompass_${{ env.RELEASE_VERSION }}.zip BabelfishCompass
- name: Get release details
run: |
export RELEASE_DETAILS="$(awk -vN=2 'n<N;/^# /{++n}' CHANGELOG.md)"
export RELEASE_DETAILS="$(sed '${/^# /d;}' <<< "$RELEASE_DETAILS")"
export RELEASE_DETAILS="$(sed '/^#/d' <<< "$RELEASE_DETAILS")"
touch RELEASE_DETAILS.md
echo "### What's New" > RELEASE_DETAILS.md
echo "$RELEASE_DETAILS" >> RELEASE_DETAILS.md
echo $'\n### md5 Verification\n' >> RELEASE_DETAILS.md
md5=($(md5sum BabelfishCompass_${{ env.RELEASE_VERSION }}.zip))
echo "BabelfishCompass_${{ env.RELEASE_VERSION }}.zip (\`$md5\`)" >> RELEASE_DETAILS.md
- name: Upload JARs to release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: "Babelfish Compass ${{ env.RELEASE_VERSION }}"
bodyFile: "RELEASE_DETAILS.md"
draft: true
artifacts: BabelfishCompass_${{ env.RELEASE_VERSION }}.zip