К основному контенту

Publish CUBA-application to GitHub Packages using GitHub Actions

Today we're going to look at how to publish CUBA-application to GitHub Packages using GitHub Actions. There is no rocket science here, but still some nuances

  • First of all, an application build on CUBA-platform has a number of modules and a number of build artifacts as a result.
  • CUBA uses Gradle as a build-tool and its own plugin
  • A Gradle-task to publish artifacts for CUBA is uploadArchives

gradle.build

Let's take a look at gradle.build. According to CUBA-Platform documentation, need to specify uploadRepository for cuba plugin:

cuba {
    ...
    uploadRepository {
        url = 'https://maven.pkg.github.com/OWNER/REPOSITORY'
        user = System.getenv("GITHUB_ACTOR")
        password = System.getenv("GITHUB_TOKEN")
    }
}

  • url - GitHub Packages artifacts repository for your git-repository.
  • user/password - will be taken from environment variables during GitHub Actions workflow execution

GitHub Actions workflow

Next, we'll need to create a directory .github/workflows in the project, where all workflow files in .yaml format are located. They will be automatically picked up by GitHub Actions and executed based on conditions, specified in those files.

Set up the build

In order to create a basic workflow to build your Gradle-project using GitHub Actions, follow the official Docs: Building and testing Java with Gradle 

General points:

  • Use caching (it's in the Docs)
  • I'm using Gradle wrapper (gradlew) to run Gradle tasks and faced issues with access. If so, add the step below before using Gradle in the workflow. Or...grant access to the gradlew file in the repo and push
- name: Grant execute permission for gradlew
  run: chmod +x gradlew

Publish step

Follow the Publishing packages to GitHub Packages except for one small thing: you should call uploadArchives task not publish
- name: Publish package
  run: ./gradlew uploadArchives
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

A working demo could be found here: https://github.com/MrArtemAA/cuba-github-packages-publish

Any issues? Drop a comment ;)

Комментарии

Популярные сообщения из этого блога

Занимательные алгоритмы. Поиск цикла в односвязном списке

И снова про тараканов, которые иногда возникают в голове. Как-то раз, засыпая, я задумался на курьезными задачками из своей сферы деятельности (Lotus Notes), которые можно было бы задать на собеседовании, плавно перешел к воспоминаниям о своих первых собеседования, когда опыта работы еще не было. Опыт самих собеседований у меня не велик а места, где задавались действительно интересные задачи (а не задачки типа: написать сортировку массива любым известным способом) вообще равны одному - это ABBYY. Как минимум одна задачка в списке на знание и понимание классических алгоритмов, описанных в книге Дональда Кнута -  Искусство программирования .

Unit-testing object validation when validator has DI

Summary Unit test object validation when validator(s) has a dependency. For instance, we have some custom field and cross-field validators. Want to test their combination. Additionally some of validators have dependencies, injected through constructor or setters. You're not using property injection, right? Shortcut If you are just searching for an answer, here's the fast way: Declare CustomConstraintValidatorFactory that implements javax.validation.ConstraintValidatorFactory Override getInstance method and on facing your constraint validator class instantiate it Otherwise delegate validator construction to org.hibernate.validator.internal.engine.constraintvalidation.ConstraintValidatorFactoryImpl Build validator factory and provide it your CustomConstraintValidatorFactory Build validator, using that factory... Go to demo project on GitHub for details:  https://github.com/MrArtemAA/blog-demos/blob/master/test-validator-with-injection/src/test/java/ru/artemaa/d

Lotus Notes FAQ. 8/9 Eclipse. Как настроить уведомления о Sametime сообщениях

Н а написание данной "инструкцию" натолкнул мой коллега. Помню, первый раз сам долго искал, как отключить постоянно выпрыгивающие уведомления о новых сообщениях в Sametime. И так, речь идет о клиентах IBM Notes 8+ версии Standart (Eclipse based). Как настроить уведомления о Sametime сообщениях?