Skip to content

Commit

Permalink
Add release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
sveinbma committed Sep 4, 2023
1 parent c006cd2 commit 68e5aff
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 46 deletions.
22 changes: 1 addition & 21 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,6 @@ jobs:
name: example-app
path: example-app/target/*.jar

- name: Upload db-scheduler-ui packages
uses: actions/upload-artifact@v3
with:
name: db-scheduler-ui
path: '**/target/*.jar'

publish:
name: Publish packages
runs-on: ubuntu-latest
needs: build

steps:
- name: download packages artifact
uses: actions/download-artifact@v3
with:
name: db-scheduler-ui

- name: show files
run: ls -a

deploy:
if: github.ref == 'refs/heads/main'
name: Deploy to Heroku
Expand All @@ -80,7 +60,7 @@ jobs:
- name: Download production-ready build files
uses: actions/download-artifact@v3
with:
name: production-files
name: example-app

- name: Deploy to Heroku
uses: akhileshns/[email protected]
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Release

on:
release:
types:
- published

jobs:
release:
name: Build and release packages
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3

- name: Install dependencies
run: npm install
working-directory: db-scheduler-ui-frontend

- name: Build frontend
run: npm run build
working-directory: db-scheduler-ui-frontend

- name: Create static folder in backend
run: mkdir -p db-scheduler-ui/src/main/resources/static

- name: Copy static frontend to java package
run: cp -r db-scheduler-ui-frontend/dist/. db-scheduler-ui/src/main/resources/static/

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Set release version
run: mvn --no-transfer-progress --batch-mode versions:set -DnewVersion=${{ github.event.release.tag_name }} -DgenerateBackupPoms=false

- name: Stage release
run: mvn --batch-mode clean deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

19 changes: 0 additions & 19 deletions db-scheduler-ui-frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions db-scheduler-ui-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.github.bekk</groupId>
<artifactId>db-scheduler-ui-parent</artifactId>
<version>0.0.1-snapshot</version>
<version>main-SNAPSHOT</version>
</parent>

<artifactId>db-scheduler-ui-starter</artifactId>
Expand All @@ -26,6 +26,14 @@
</dependencies>
</dependencyManagement>

<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/bekk/db-scheduler-ui</url>
</repository>
</distributionManagement>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand All @@ -44,7 +52,7 @@
<dependency>
<groupId>com.github.bekk</groupId>
<artifactId>db-scheduler-ui</artifactId>
<version>0.0.1-snapshot</version>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
10 changes: 9 additions & 1 deletion db-scheduler-ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.github.bekk</groupId>
<artifactId>db-scheduler-ui-parent</artifactId>
<version>0.0.1-snapshot</version>
<version>main-SNAPSHOT</version>
</parent>

<artifactId>db-scheduler-ui</artifactId>
Expand All @@ -26,6 +26,14 @@
</dependencies>
</dependencyManagement>

<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/bekk/db-scheduler-ui</url>
</repository>
</distributionManagement>

<dependencies>
<dependency>
<groupId>com.github.kagkarlsson</groupId>
Expand Down
4 changes: 2 additions & 2 deletions example-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.github.bekk</groupId>
<artifactId>db-scheduler-ui-parent</artifactId>
<version>0.0.1-snapshot</version>
<version>main-SNAPSHOT</version>
</parent>


Expand Down Expand Up @@ -55,7 +55,7 @@
<dependency>
<groupId>com.github.bekk</groupId>
<artifactId>db-scheduler-ui-starter</artifactId>
<version>0.0.1-snapshot</version>
<version>main-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.bekk</groupId>
<artifactId>db-scheduler-ui-parent</artifactId>
<version>0.0.1-snapshot</version>
<version>main-SNAPSHOT</version>
<packaging>pom</packaging>
<name>db-scheduler-ui: Parent</name>
<description>Provides a UI for db-scheduler</description>
Expand Down

0 comments on commit 68e5aff

Please sign in to comment.