Skip to content

Commit

Permalink
Release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
kwart committed Aug 13, 2023
1 parent 77fe057 commit f7efd80
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 11 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/do-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Do Release

on:
workflow_dispatch:
inputs:
release-version:
description: 'Version to be released (e.g. 2.3.0).'
required: true
next-snapshot-version:
description: 'Version to be set after the release - without the -SNAPSHOT suffix (e.g. 2.4.0).'
required: true

env:
GIT_AUTHOR_NAME: Flash Gordon
GIT_AUTHOR_EMAIL: <>
GIT_COMMITTER_NAME: Terminator the Kitty
GIT_COMMITTER_EMAIL: <>
jobs:
do-release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Java and credentials
uses: actions/setup-java@v3
with:
java-version: 8
distribution: 'adopt'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
cache: 'maven'

- name: Do the Deployment and related stuff
run: |
VERSION=${{ github.event.inputs.release-version }}
FULL_VERSION="JSignPdf-$VERSION"
NEXT_VERSION=${{ github.event.inputs.next-snapshot-version }}-SNAPSHOT
TAG=JSignPdf_${VERSION//\./_}
mvn -P release --batch-mode "-Dtag=${TAG}" -DdryRun=true release:prepare \
"-DreleaseVersion=${VERSION}" \
"-DdevelopmentVersion=${NEXT_VERSION}"
mvn -P release --batch-mode -DdryRun=true release:perform
docker run --rm -v "$(pwd):/mnt" \
-u $(id -u):$(id -g) kwart/innosetup \
/mnt/distribution/windows/create-jsignpdf-installer.sh
cd distribution/target
ls -R
mkdir "JSignPdf-$VERSION"
mv *.zip *.exe "$FULL_VERSION/"
cp generated-docs/JSignPdf.pdf "$FULL_VERSION/$FULL_VERSION.pdf"
cp generated-docs/ReleaseNotes.txt "$FULL_VERSION/README.txt"
echo "${{ secrets.SSH_PRIVATE_KEY }}" >> private_key
chmod 600 private_key
sftp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i private_key [email protected]:/home/frs/project/jsignpdf/test <<EOF
put -R "${FULL_VERSION}"
exit
EOF
env:
MAVEN_USERNAME: ${{ secrets.SONATYPE_OSS_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.SONATYPE_OSS_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
15 changes: 4 additions & 11 deletions .github/workflows/push-snapshots.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Apache Maven Central
uses: actions/setup-java@v2
- uses: actions/checkout@v3
- name: Set up Java and credentials
uses: actions/setup-java@v3
with:
java-version: 8
distribution: 'adopt'
Expand All @@ -24,14 +24,7 @@ jobs:
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

cache: 'maven'
- name: Publish to Apache Maven Central
run: |
PROJECT_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
Expand Down

0 comments on commit f7efd80

Please sign in to comment.