Skip to content

Commit

Permalink
chore: add release workflow (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcollovati authored Dec 29, 2023
1 parent 8408f8f commit 8139e42
Show file tree
Hide file tree
Showing 11 changed files with 290 additions and 69 deletions.
107 changes: 107 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: Release
run-name: "Release ${{ inputs.version }} from branch ${{ inputs.target-branch }} ${{ inputs.dry-run && '(DRY RUN)' || ''}}"
on:
workflow_dispatch:
inputs:
target-branch:
description: "Branch to release"
required: true
type: choice
default: 'development'
options:
- "development"
version:
description: "Version to release (e.g. 1.1.0 or 1.2.0-alpha1)"
required: true
type: string
dry-run:
description: "Dry run (skips remote operations)"
required: true
type: boolean
default: false
jobs:
release:
name: Release
runs-on: ubuntu-latest

steps:
- uses: actions-cool/check-user-permission@main
id: checkUser
with:
username: ${{github.triggering_actor}}
check-contributor: true
require: 'write'
- name: Fail on workflow triggered by external contributor
if: ${{ steps.checkUser.outputs.require-result != 'true' }}
run: |
echo "🚫 **${{ github.actor }}** is an external contributor, only **${{ github.repository }}** team members can perform a release" \
| tee -a $GITHUB_STEP_SUMMARY && exit 1
- name: Validate Workflow branch
if: ${{ !github.event.inputs.dry-run }}
run: |
BRANCH_NAME=${GITHUB_REF##*/}
if [[ "development" != "${BRANCH_NAME}" ]]; then
echo "🚫 Release Workflow must be dispatched on 'development' branch." \
| tee -a $GITHUB_STEP_SUMMARY
exit 1
fi
- name: Checkout
uses: actions/checkout@v3
with:
ref: refs/heads/${{ inputs.target-branch }}
fetch-depth: 0

- name: Validate version
run: |
VERSION_REGEX='^[0-9]+\.[0-9]+\.[0-9]+(-(alpha|beta|rc)[0-9]+)?$'
if [[ ! "${{ inputs.version }}" =~ $VERSION_REGEX ]]; then
echo "🚫 Invalid version specified: '${{ inputs.version }}'. Please enter a valid SemVer version, like '1.2.3' or '1.0.0-alpha1'." \
| tee -a $GITHUB_STEP_SUMMARY
exit 1
fi
#if [[ "${{ inputs.target-branch }}" != "development" && ! "${{ inputs.version }}" = "${{ inputs.target-branch }}."* ]]; then
# echo "🚫 Invalid version specified: '${{ inputs.version }}' does not match the release branch '${{ inputs.target-branch }}'." \
# | tee -a $GITHUB_STEP_SUMMARY
# exit 1
#fi
if git rev-parse -q --verify "refs/tags/flow-${{ inputs.version }}" > /dev/null; then
echo "🚫 Version '${{ inputs.version }}' already exists. Please choose a different version." \
| tee -a $GITHUB_STEP_SUMMARY
exit 1
fi
echo "Releasing version '${{ inputs.version }}' from branch '${{ inputs.target-branch }}'." | tee -a $GITHUB_STEP_SUMMARY
if [[ "${{ github.event.inputs.dry-run }}" == "true" ]]; then
echo "⚠️ dry-run execution, artifacts will not be published on Maven Central." | tee -a $GITHUB_STEP_SUMMARY
fi
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
- name: Set version
run:
mvn -N version:set-version -DnewVersion="${{ inputs.version }}"
- name: Staging artifacts
run: |
mvn -V -ntp -Prelease -DaltDeploymentRepository=local::file:./target/staging-deploy -DskipTests deploy
- name: Run JReleaser
env:
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JRELEASER_NEXUS2_MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
JRELEASER_NEXUS2_MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.MAVEN_GPG_PUBLIC }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
run: |
mvn -N -V -ntp -Prelease -Djreleaser.dry.run="${{ github.event.inputs.dry-run }}" -DskipTests jreleaser:full-release
- name: JReleaser release output
if: always()
uses: actions/upload-artifact@v3
with:
name: jreleaser-release
path: |
target/jreleaser/trace.log
target/jreleaser/output.properties
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.vertx/

uber-pom.xml
.flattened-pom.xml
node_modules/
package.json
package-lock.json
Expand Down
110 changes: 109 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@
<checkstyle.skip>true</checkstyle.skip>

<distribution.snapshots.id>repsy-vertx-vaadin-snapshots</distribution.snapshots.id>
<distribution.snapshots.url>https://repo.repsy.io/mvn/mcollovati/vertx-vaadin-snapshots</distribution.snapshots.url>
<distribution.snapshots.url>https://repo.repsy.io/mvn/mcollovati/vertx-vaadin-snapshots
</distribution.snapshots.url>
<distribution.releases.id>repsy-vertx-vaadin</distribution.releases.id>
<distribution.releases.url>https://repo.repsy.io/mvn/mcollovati/vertx-vaadin</distribution.releases.url>

Expand All @@ -103,6 +104,8 @@
<maven-source-plugin.version>3.1.0</maven-source-plugin.version>
<maven-javadoc-plugin.version>3.3.2</maven-javadoc-plugin.version>
<maven-deploy-plugin.version>3.1.1</maven-deploy-plugin.version>
<flatten-maven-plugin.version>1.5.0</flatten-maven-plugin.version>
<jreleaser-maven-plugin.version>1.9.0</jreleaser-maven-plugin.version>

<vertx.version>4.3.0</vertx.version>
<vaadin.platform.version>23.3.30</vaadin.platform.version>
Expand Down Expand Up @@ -385,6 +388,7 @@
<pushRemote>true</pushRemote>
</configuration>
</plugin>
<!--
<plugin>
<groupId>com.igormaznitsa</groupId>
<artifactId>uber-pom</artifactId>
Expand Down Expand Up @@ -415,11 +419,22 @@
</execution>
</executions>
</plugin>
-->
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>${nexus-staging-maven-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.jreleaser</groupId>
<artifactId>jreleaser-maven-plugin</artifactId>
<version>${jreleaser-maven-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>${flatten-maven-plugin.version}</version>
</plugin>
</plugins>
</pluginManagement>
</build>
Expand All @@ -434,6 +449,10 @@
<profiles>
<profile>
<id>release</id>
<properties>
<jreleaser.signing.mode>MEMORY</jreleaser.signing.mode>
<release.mavencentral.active>ALWAYS</release.mavencentral.active>
</properties>
<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -462,6 +481,95 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<configuration>
<outputDirectory>${project.basedir}</outputDirectory>
<updatePomFile>true</updatePomFile>
<flattenMode>oss</flattenMode>
<pomElements>
<repositories>remove</repositories>
</pomElements>
</configuration>
<executions>
<execution>
<id>flatten</id>
<phase>process-classes</phase>
<goals>
<goal>flatten</goal>
</goals>
</execution>
<execution>
<id>flatten.clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jreleaser</groupId>
<artifactId>jreleaser-maven-plugin</artifactId>
<inherited>false</inherited>
<configuration>
<jreleaser>
<release>
<github>
<owner>mcollovati</owner>
<name>quarkus-hilla</name>
<changelog>
<formatted>ALWAYS</formatted>
<preset>conventional-commits</preset>
<skipMergeCommits>true</skipMergeCommits>
<hide>
<categories>
<category>merge</category>
<category>tasks</category>
<category>build</category>
</categories>
<contributors>
<contributor>GitHub</contributor>
<contributor>[bot]</contributor>
</contributors>
</hide>
<contributors>
<format>- {{contributorName}}</format>
</contributors>
</changelog>
<draft>true</draft>
<tagName>flow-{{projectVersion}}</tagName>
<releaseName>Release flow-{{tagName}}</releaseName>
<prerelease>
<pattern>.*-(alpha|beta|rc)\d+</pattern>
</prerelease>
</github>
</release>
<deploy>
<maven>
<nexus2>
<maven-central>
<active>${release.mavencentral.active}</active>
<url>https://oss.sonatype.org/service/local</url>
<snapshotUrl>
https://s01.oss.sonatype.org/content/repositories/snapshots/
</snapshotUrl>
<closeRepository>true</closeRepository>
<releaseRepository>true</releaseRepository>
<stagingRepositories>target/staging-deploy</stagingRepositories>
</maven-central>
</nexus2>
</maven>
</deploy>
<signing>
<active>ALWAYS</active>
<mode>${jreleaser.signing.mode}</mode>
<armored>true</armored>
</signing>
</jreleaser>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Expand Down
4 changes: 0 additions & 4 deletions vaadin-flow-sockjs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.igormaznitsa</groupId>
<artifactId>uber-pom</artifactId>
</plugin>
</plugins>
</build>

Expand Down
49 changes: 45 additions & 4 deletions vertx-vaadin-flow-jandex/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,52 @@
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>com.igormaznitsa</groupId>
<artifactId>uber-pom</artifactId>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>release</id>
<properties>
<maven.javadoc.skip>true</maven.javadoc.skip>
<maven.source.skip>true</maven.source.skip>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>empty-javadocs</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>javadoc</classifier>
<excludes>
<exclude>**</exclude>
</excludes>
</configuration>
</execution>
<execution>
<id>empty-sources</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>sources</classifier>
<excludes>
<exclude>**</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
4 changes: 0 additions & 4 deletions vertx-vaadin-flow/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,6 @@
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>com.igormaznitsa</groupId>
<artifactId>uber-pom</artifactId>
</plugin>
</plugins>
</build>

Expand Down
11 changes: 1 addition & 10 deletions vertx-vaadin-quarkus-extension/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
</parent>
<artifactId>vertx-vaadin-quarkus-extension-deployment</artifactId>
<name>Vertx Vaadin Extension - Deployment</name>
<description>Vertx Vaadin Extension - Deployment</description>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
Expand Down Expand Up @@ -44,16 +45,6 @@
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<groupId>com.igormaznitsa</groupId>
<artifactId>uber-pom</artifactId>
<executions>
<execution>
<id>default</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Loading

0 comments on commit 8139e42

Please sign in to comment.