• This repository has been archived on 23/Jan/2023
  • Stars
    star
    101
  • Rank 338,166 (Top 7 %)
  • Language
    JavaScript
  • Created about 5 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿ“ฆ GitHub Action for automatically publishing Maven packages

Maven Publish Action

GitHub Action for automatically publishing Maven packages

Overview

This actionโ€ฆ

  • Executes the Maven deploy lifecycle phase
  • Provides Maven with your GPG key and passphrase so your artifacts can be signed using maven-gpg-plugin
  • Provides Maven with your Nexus credentials so it can deploy and release your project

It will also use the deploy Maven profile if you've defined one (in case you want to perform certain steps only when deploying).

Setup

Deployment

It's recommended to publish using the Nexus Staging Maven Plugin, which greatly simplifies the process. You can follow this guide for a simple configuration.

Make sure your project is correctly configured for deployment before continuing with the next step.

Workflow

Secrets

In your project's GitHub repository, go to Settings โ†’ Secrets. On this page, set the following variables:

  • nexus_username: Username (not email!) for your Nexus repository manager account
  • nexus_password: Password for your Nexus account (or, even better, use the auth token instead)

Signing your artifact using GPG is optional, but recommended. If you choose to use GPG, add the following secrets:

  • gpg_private_key: GPG private key for signing the published artifacts:
    • Run gpg --list-secret-keys and copy the ID of the key you'd like to use
    • Export the key with gpg -a --export-secret-keys KEY_ID (and replace KEY_ID with the ID you copied)
  • gpg_passphrase: Passphrase for the GPG key

If you sign your artifacts, make sure the maven-gpg-plugin is configured as described here.

Workflow file

Create a GitHub workflow file (e.g. .github/workflows/release.yml) in your repository. Use the following configuration, which tells GitHub to use the Maven Publish Action when running your CI pipeline. The steps are self-explanatory:

name: Release

# Run workflow on commits to the `master` branch
on:
  push:
    branches:
      - master

jobs:
  release:
    runs-on: ubuntu-18.04
    steps:
      - name: Check out Git repository
        uses: actions/checkout@v2

      - name: Install Java and Maven
        uses: actions/setup-java@v1
        with:
          java-version: 11

      - name: Release Maven package
        uses: samuelmeuli/action-maven-publish@v1
        with:
          gpg_private_key: ${{ secrets.gpg_private_key }}
          gpg_passphrase: ${{ secrets.gpg_passphrase }}
          nexus_username: ${{ secrets.nexus_username }}
          nexus_password: ${{ secrets.nexus_password }}

The action will now run every time you push to master.

Configuration

In addition to the input variables listed above, the action can be configured with the following options:

  • directory: Directory of the Maven project to deploy. Default: Repository root
  • maven_profiles: Active Maven profiles. Default: "deploy"
  • maven_goals_phases: Maven goals and build phases to execute. Default: "clean deploy"
  • maven_args: Additional arguments to pass to the Maven command. Default: ""
  • server_id: The default Nexus instance used by this action is OSSRH. If you are deploying to a different Nexus instance, you can specify the server ID you've used in your project's POM file (in the nexus-staging-maven-plugin and distributionManagement configurations) here

Development

Suggestions and contributions are always welcome! Please discuss larger changes via issue before submitting a pull request.

Related

More Repositories

1

mini-diary

๐Ÿ“˜ Simple and secure journal app
TypeScript
1,031
star
2

glance

๐Ÿ”Ž All-in-one Quick Look plugin
Swift
953
star
3

action-electron-builder

:electron: GitHub Action for building and releasing Electron apps
JavaScript
651
star
4

tmignore

๐Ÿ•” Exclude development files from Time Machine backups
Swift
322
star
5

font-picker

โœ๏ธ Font selector component for Google Fonts
TypeScript
171
star
6

font-picker-react

โœ๏ธ Font selector component for Google Fonts
TypeScript
152
star
7

react-magnifier

๐Ÿ” React image zoom component
TypeScript
151
star
8

lyrics-poster

๐ŸŽค Create posters of your favorite artists, written in their lyrics
JavaScript
63
star
9

refind-theme-dark

๐ŸŽจ A simple, dark theme for rEFInd
54
star
10

action-snapcraft

๐Ÿฆ GitHub Action for setting up Snapcraft
JavaScript
49
star
11

font-manager

๐Ÿ—‚ Manages, downloads and applies Google Fonts for picker components
TypeScript
27
star
12

swift-exec

๐Ÿš€ Simple process execution with Swift
Swift
16
star
13

draft-js-list-plugin

๐Ÿ“ Better lists for Draft.js
TypeScript
14
star
14

python-wikibase

๐Ÿค– Wikibase queries and edits made easy
Python
11
star
15

nbtohtml

๐Ÿ“ˆ Convert Jupyter Notebook files to HTML
Go
9
star
16

github-downloads

โฌ‡๏ธ See the number of downloads next to releases on GitHub
JavaScript
8
star
17

alfred-system-theme

๐ŸŽจ Alfred themes in style of Apple's macOS apps
7
star
18

react-library-boilerplate

๐Ÿ”จ Create a React component library with no configuration
JavaScript
6
star
19

iconsets.org

๐ŸŒŸ Icon set discovery website for designers
JavaScript
5
star
20

wikibase-api

๐Ÿ“ฆ Wrapper library for the Wikibase API
Python
4
star
21

anonymize-ip

๐Ÿ‘ค Python library for anonymizing IP addresses
Python
4
star
22

strava-bulk-edit

๐Ÿƒ Edit multiple Strava activities at once
Go
2
star
23

electron-md-to-pdf

:electron: Convert Markdown to PDF in Electron apps
CSS
2
star
24

hugo-starter-theme

๐Ÿ”จ Boilerplate for building a custom Hugo theme
HTML
2
star
25

samuelmeuli.com

๐Ÿ‘จโ€๐Ÿ’ป My personal website
CSS
1
star
26

music-notifications

๐ŸŽต Notification service for new releases on iTunes
JavaScript
1
star
27

prettier-config

โ˜‘๏ธ My Prettier configuration
JavaScript
1
star
28

react-app-boilerplate

๐Ÿ”จ Create a React application with no configuration
JavaScript
1
star