Skip to content

Commit

Permalink
ci: create workflows for doing github releases
Browse files Browse the repository at this point in the history
  • Loading branch information
Realiserad committed Mar 7, 2024
1 parent 55315a6 commit 71019f5
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 46 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/publish-jars.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Publish JAR files to GitHub Packages
on:
release:
types: [created]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Publish package
run: mvn --batch-mode deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33 changes: 33 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Create a GitHub release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
branches:
- "ci/create-releases"
jobs:
maven:
name: Maven
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Build and test
run: |
sudo apt install softhsm2
SLOT_ID=$(softhsm2-util --init-token --free --label "test" --pin 1234 --so-pin 1234 | tail -n 1 | awk '{ print $NF }')
export JACKNJI11_TEST_TESTSLOT="$SLOT_ID"
export JACKNJI11_TEST_INITSLOT="$SLOT_ID"
export JACKNJI11_TEST_USER_PIN=1234
export JACKNJI11_TEST_SO_PIN=1234
export JACKNJI11_PKCS11_LIB_PATH=/usr/lib/x86_64-linux-gnu/softhsm/libsofthsm2.so
mvn --no-transfer-progress package
- name: Release
uses: softprops/action-gh-release@v1
with:
files: target/*.jar
25 changes: 0 additions & 25 deletions build.xml

This file was deleted.

74 changes: 53 additions & 21 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>

<groupId>org.pkcs11</groupId>
<groupId>com.keyfactor</groupId>
<artifactId>jacknji11</artifactId>
<version>1.3-SNAPSHOT</version>
<version>1.3.0</version>
<name>jacknji11</name>
<packaging>jar</packaging>


<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
</properties>

<inceptionYear>2010</inceptionYear>

<description>
Java Native Interface for PKCS#11
</description>
<url>https://github.com/joelhockey/jacknji11</url>
<description>Java Native Interface for PKCS#11</description>

<url>https://github.com/Keyfactor/jacknji11</url>

<licenses>
<license>
Expand All @@ -30,25 +34,56 @@
<email>[email protected]</email>
<organizationUrl>https://github.com/joelhockey/jacknji11</organizationUrl>
</developer>

<developer>
<name>Keyfactor</name>
<email>[email protected]</email>
<organizationUrl>https://keyfactor.com</organizationUrl>
</developer>
</developers>

<scm>
<connection>scm:git:https://github.com/joelhockey/jacknji11.git</connection>
<developerConnection>scm:git:[email protected]:joelhockey/jacknji11.git</developerConnection>
<url>https://github.com/joelhockey/jacknji11</url>
</scm>
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/keyfactor/jacknji11</url>
</repository>
</distributionManagement>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<forkCount>3</forkCount>
<reuseForks>false</reuseForks>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand All @@ -63,16 +98,13 @@
<artifactId>jnr-ffi</artifactId>
<version>0.6.0</version>
</dependency>

<!-- provided -->
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
<scope>provided</scope>
</dependency>

<!-- test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down

0 comments on commit 71019f5

Please sign in to comment.