Skip to content

Commit

Permalink
Add release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
kezhenxu94 committed Apr 21, 2023
1 parent 4d66a1c commit 085918c
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/Release.yaml
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 origin master
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

0 comments on commit 085918c

Please sign in to comment.