-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4d66a1c
commit 663a13b
Showing
1 changed file
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- v\d+\.\d+\.\d+ | ||
|
||
jobs: | ||
Release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Checkout source codes | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 10 | ||
cache: npm | ||
cache-dependency-path: yasa-ui/package-lock.json | ||
- name: Setup Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: 11 | ||
distribution: temurin | ||
cache: maven | ||
- name: Build | ||
run: | | ||
./mvnw -B versions:set -DgenerateBackupPoms=false -DnewVersion=${GITHUB_REF_NAME#v} | ||
./mvnw -B clean package | ||
- name: Upload Assets | ||
id: uploaded-assets | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: yasa-solr-plugin/target/yasa-solr-plugin-*.jar | ||
- name: Sign Jar | ||
id: sign-jar | ||
run: | | ||
cat <<EOF > private-key.pem | ||
${{ secrets.SOLR_PACKAGE_SIGN_PRIVATE_KEY }} | ||
EOF | ||
sig=$(openssl dgst -sha1 -sign private-key.pem yasa-solr-plugin/target/yasa-solr-plugin-*.jar | openssl enc -base64 | tr -d \\n) | ||
echo "sig=$sig" | tee -a $GITHUB_OUTPUT | ||
- name: Update Repo | ||
run: | | ||
git reset --hard origin/master | ||
git pull --rebase | ||
git config --global user.name "github-actions[bot]" | ||
git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
url=${{ fromJSON(steps.uploaded-assets.outputs.assets)[0].browser_download_url }} | ||
sig=${{ steps.sign-jar.outputs.sig }} | ||
jq '.[0].versions[.[0].versions | length] |= . + { | ||
"version": '"\"${GITHUB_REF_NAME#v}"\"', | ||
"date": '"\"$(date +%Y-%m-%d)\""', | ||
"artifacts": [ | ||
{ | ||
"url": '"\"$url\""', | ||
"sig": '"\"$sig\""' | ||
} | ||
] | ||
}' repo/repository.json | tee repo/repository.json.tmp | ||
mv repo/repository.json.tmp repo/repository.json | ||
git add repo/repository.json **/pom.xml | ||
git commit -m "Update repository.json" | ||
git push origin HEAD:master | ||