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 15, 2023
1 parent 33815b3 commit c3d92b7
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 40 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 }}
86 changes: 51 additions & 35 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.redhat.ecosystemappeng</groupId>
Expand Down Expand Up @@ -187,6 +185,8 @@
<arguments>-Pprepare-deployment,deploy-github</arguments>
<scmCommentPrefix>build(release): [skip ci] </scmCommentPrefix>
<signTag>true</signTag>
<goals>install</goals>
<tagNameFormat>v@{project.version}</tagNameFormat>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -564,7 +564,7 @@ limitations under the License.]]>
<goal>yarn</goal>
</goals>
<configuration>
<arguments>publish</arguments>
<arguments>run publish:snapshot</arguments>
</configuration>
</execution>
</executions>
Expand All @@ -579,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
3 changes: 2 additions & 1 deletion src/filtered/js-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"scripts": {
"lint": "eslint model/**/* --ext js --fix",
"precompile": "rm -rf dist && npm run lint",
"compile": "tsc -p tsconfig.json"
"compile": "tsc -p tsconfig.json",
"publish:snapshot": "npm version prerelease --preid snapshot && npm publish --tag snpashot"
},
"keywords": [
"analysis",
Expand Down

0 comments on commit c3d92b7

Please sign in to comment.