Skip to content

Commit

Permalink
chore: update release and publish process
Browse files Browse the repository at this point in the history
Signed-off-by: Ruben Romero Montes <[email protected]>
  • Loading branch information
ruromero committed Nov 14, 2023
1 parent ea2495c commit 8ca03aa
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 38 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: CI
on:
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/cicd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ on:
push:
branches:
- main
tags:
- '*'
workflow_dispatch: # allow this workflow to be called by other workflows

concurrency:
Expand Down Expand Up @@ -38,7 +36,7 @@ jobs:
uses: char0n/swagger-editor-validate@v1
with:
definition-file: api/v4/openapi.yaml
deploy-packages:
deploy-latest-packages:
if: github.repository_owner == 'RHEcosystemAppEng'
runs-on: ubuntu-latest
permissions:
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Publish
on:
release:
types: [published]

jobs:
deploy-packages:
if: github.repository_owner == 'RHEcosystemAppEng'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
name: Deploy
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Java 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Set NPM auth token
run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc
- name: Build and Publish to GitHub Maven Packages
run: mvn -B deploy -Prelease --file pom.xml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The packages are published to the GitHub maven repository. Make sure to add it t
<dependency>
<groupId>com.redhat.ecosystemappeng</groupId>
<artifactId>exhort-api</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>1.0.1-SNAPSHOT</version>
</dependency>
```

Expand All @@ -36,5 +36,5 @@ echo "@RHEcosystemAppEng:registry=https://npm.pkg.github.com" >> .npmrc
Then, add it to your project as follows:

```bash
npm install @RHEcosystemAppEng/[email protected].0-SNAPSHOT
npm install @RHEcosystemAppEng/[email protected].1-SNAPSHOT
```
82 changes: 50 additions & 32 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>14</maven.compiler.release>
<js-api>${project.build.directory}/js-api</js-api>
<maven.build.timestamp.format>yyyyMMdd.HHmmss</maven.build.timestamp.format>
<timestamp>${maven.build.timestamp}</timestamp>
<!-- Dependencies -->
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
Expand Down Expand Up @@ -562,7 +564,7 @@ limitations under the License.]]>
<goal>yarn</goal>
</goals>
<configuration>
<arguments>publish</arguments>
<arguments>publish --new-version ${timestamp}</arguments>
</configuration>
</execution>
</executions>
Expand All @@ -577,44 +579,60 @@ limitations under the License.]]>
</build>

<profiles>
<!-- use this profile for development stage -->
<profile>
<id>dev</id>
<properties>
<enforcer.skip>true</enforcer.skip>
<license.skip>true</license.skip>
</properties>
<id>release</id>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>${frontend-maven-plugin.version}</version>
<executions>
<execution>
<id>install node and yarn</id>
<phase>initialize</phase>
<goals>
<goal>install-node-and-yarn</goal>
</goals>
</execution>
<execution>
<id>yarn install</id>
<phase>compile</phase>
<goals>
<goal>yarn</goal>
</goals>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>yarn compile</id>
<phase>compile</phase>
<goals>
<goal>yarn</goal>
</goals>
<configuration>
<arguments>run compile</arguments>
</configuration>
</execution>
<execution>
<id>yarn publish</id>
<phase>deploy</phase>
<goals>
<goal>yarn</goal>
</goals>
<configuration>
<arguments>publish</arguments>
</configuration>
</execution>
</executions>
<configuration>
<failOnWarning>false</failOnWarning>
<nodeVersion>${node.version}</nodeVersion>
<yarnVersion>${yarn.version}</yarnVersion>
<workingDirectory>${js-api}</workingDirectory>
<installDirectory>target</installDirectory>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<!-- use this profile to include github registry distribution definition -->
<!-- requires credentials set for github in ~/.m2/settings.xml -->
<profile>
<id>deploy-github</id>
<distributionManagement>
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/RHEcosystemAppEng/exhort-api-spec</url>
</repository>
<snapshotRepository>
<id>github</id>
<url>https://maven.pkg.github.com/RHEcosystemAppEng/exhort-api-spec</url>
</snapshotRepository>
</distributionManagement>
</profile>
<!-- use this profile for packaging of jars to deploy to artifact repository -->
<profile>
<id>prepare-deployment</id>
<build>
<plugins>
<!-- flatten-maven-plugin:flatten is bound to the process-resources phase and will create
a .flattened-pom.xml -->
<plugin>
Expand Down

0 comments on commit 8ca03aa

Please sign in to comment.