forked from liquibase/liquibase
-
Notifications
You must be signed in to change notification settings - Fork 0
150 lines (131 loc) · 6.67 KB
/
release-published.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
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
name: Release Published
on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: 'Release Tag'
required: true
jobs:
setup:
name: Setup
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.collect-data.outputs.tag }}
version: ${{ steps.collect-data.outputs.version }}
steps:
- name: Collect Data
id: collect-data
uses: actions/github-script@v4
with:
script: |
let tag;
if (context.payload.inputs) {
tag = context.payload.inputs.tag;
} else {
tag = context.payload.release.tag_name;
}
let version = tag.replace(/^v/, "");
core.setOutput("tag", tag);
core.setOutput("version", version);
- run: |
echo "Publishing version ${{ steps.collect-data.outputs.version }} from ${{ steps.collect-data.outputs.tag }}"
deploy_maven:
name: Deploy to Maven
needs: [ setup ]
runs-on: ubuntu-latest
steps:
- name: Download release assets
uses: robinraju/[email protected]
with:
repository: "liquibase/liquibase"
tag: "${{ needs.setup.outputs.tag }}"
filename: "*"
out-file-path: "."
- name: Set up Java for publishing to Maven Central Repository
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
server-id: sonatype-nexus-staging
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_SECRET }}
gpg-passphrase: GPG_PASSPHRASE
env:
GPG_PASSWORD: ${{ secrets.GPG_PASSPHRASE }}
- name: Publish to Maven Central
env:
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.SONATYPE_TOKEN }}
GPG_PASSWORD: ${{ secrets.GPG_PASSPHRASE }}
run: |
version=${{ needs.setup.outputs.version }}
unzip liquibase-additional-*.zip
##extracts and sign poms
unzip -j liquibase-${version}.jar META-INF/maven/org.liquibase/liquibase-core/pom.xml
mv pom.xml liquibase-${version}.pom
gpg --batch --pinentry-mode=loopback --passphrase "$GPG_PASSWORD" -ab liquibase-${version}.pom
unzip -j liquibase-maven-plugin-${version}.jar META-INF/maven/org.liquibase/liquibase-maven-plugin/pom.xml
mv pom.xml liquibase-maven-plugin-${version}.pom
sed -i -e "s/<description>/<name>Liquibase Maven Plugin<\/name><description>/" liquibase-maven-plugin-${version}.pom ## name didn't end up in pom. Hack it in for now
gpg --batch --pinentry-mode=loopback --passphrase "$GPG_PASSWORD" -ab liquibase-maven-plugin-${version}.pom
unzip -j liquibase-cdi-${version}.jar META-INF/maven/org.liquibase/liquibase-cdi/pom.xml
mv pom.xml liquibase-cdi-${version}.pom
sed -i -e "s/<description>/<name>Liquibase CDI Plugin<\/name><description>/" liquibase-cdi-${version}.pom ## name didn't end up in pom. Hack it in for now
gpg --batch --pinentry-mode=loopback --passphrase "$GPG_PASSWORD" -ab liquibase-cdi-${version}.pom
mvn -B org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy-file \
-Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ \
-DrepositoryId=sonatype-nexus-staging \
-DpomFile=liquibase-${version}.pom \
-DgeneratePom=false \
-Dfile=liquibase-${version}.jar \
-Dsources=liquibase-${version}-sources.jar \
-Djavadoc=liquibase-${version}-javadoc.jar \
-Dfiles=liquibase-${version}.jar.asc,liquibase-${version}-sources.jar.asc,liquibase-${version}-javadoc.jar.asc,liquibase-${version}.pom.asc \
-Dtypes=jar.asc,jar.asc,jar.asc,pom.asc \
-Dclassifiers=,sources,javadoc,
mvn -B org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy-file \
-Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ \
-DrepositoryId=sonatype-nexus-staging \
-DpomFile=liquibase-maven-plugin-${version}.pom \
-DgeneratePom=false \
-Dfile=liquibase-maven-plugin-${version}.jar \
-Dsources=liquibase-maven-plugin-${version}-sources.jar \
-Djavadoc=liquibase-maven-plugin-${version}-javadoc.jar \
-Dfiles=liquibase-maven-plugin-${version}.jar.asc,liquibase-maven-plugin-${version}-sources.jar.asc,liquibase-maven-plugin-${version}-javadoc.jar.asc,liquibase-maven-plugin-${version}.pom.asc \
-Dtypes=jar.asc,jar.asc,jar.asc,pom.asc \
-Dclassifiers=,sources,javadoc,
mvn -B org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy-file \
-Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ \
-DrepositoryId=sonatype-nexus-staging \
-DpomFile=liquibase-cdi-${version}.pom \
-DgeneratePom=false \
-Dfile=liquibase-cdi-${version}.jar \
-Dsources=liquibase-cdi-${version}-sources.jar \
-Djavadoc=liquibase-cdi-${version}-javadoc.jar \
-Dfiles=liquibase-cdi-${version}.jar.asc,liquibase-cdi-${version}-sources.jar.asc,liquibase-cdi-${version}-javadoc.jar.asc,liquibase-cdi-${version}.pom.asc \
-Dtypes=jar.asc,jar.asc,jar.asc,pom.asc \
-Dclassifiers=,sources,javadoc,
## Release repository
## Have to find the stagingRepositoryId that was auto-generated
rcList=$(mvn -B org.sonatype.plugins:nexus-staging-maven-plugin:1.6.8:rc-list -DnexusUrl=https://oss.sonatype.org/ -DserverId=sonatype-nexus-staging)
#echo $rcList
stagingRepositoryId=$(echo $rcList | grep -o "\[INFO\] orgliquibase-[0-9]*[ ]*OPEN" | grep -o "orgliquibase-[0-9]*")
echo "Staging Repository Id: $stagingRepositoryId"
if [ "$(echo $stagingRepositoryId | grep -o "\-" | wc -l)" != "1" ]; then
echo "Did not find exactly one open repository"
exit 1
fi
mvn org.sonatype.plugins:nexus-staging-maven-plugin:1.6.8:rc-close \
-DnexusUrl=https://oss.sonatype.org/ \
-DserverId=sonatype-nexus-staging \
-DstagingRepositoryId=$stagingRepositoryId \
-DstagingProgressTimeoutMinutes=10
mvn org.sonatype.plugins:nexus-staging-maven-plugin:1.6.8:rc-release \
-DautoDropAfterRelease=true \
-DnexusUrl=https://oss.sonatype.org/ \
-DserverId=sonatype-nexus-staging \
-DstagingRepositoryId=$stagingRepositoryId \
-DstagingProgressTimeoutMinutes=10