Skip to content

Deploy Tagged Release #20

Deploy Tagged Release

Deploy Tagged Release #20

Workflow file for this run

on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
release:
description: 'Delpoy release?'
type: boolean
default: false
website:
description: 'Deploy website?'
type: boolean
default: false
pages-branch:
description: 'Pages branch name'
default: nist-pages
name: Deploy Tagged Release
jobs:
deploy-to-nexus:
name: Build and Publish Java Artifacts
runs-on: ubuntu-latest
permissions:
actions: read
contents: write
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
with:
submodules: recursive
filter: tree:0
# -------------------------
# Java
# -------------------------
- name: Set up Maven
uses: stCarolas/setup-maven@07fbbe97d97ef44336b7382563d66743297e442f
with:
maven-version: 3.9.3
- name: Set up JDK 11
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0
with:
java-version: 11
distribution: 'temurin'
cache: 'maven'
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
server-username: MAVEN_USERNAME # env variable for username in deploy
server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
# -------------------------
# Maven Deploy
# -------------------------
- name: Deploy Maven Artifacts
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && contains('true', github.event.inputs.release))
run: |
mvn -B -e -Pgpg -Prelease -Preporting deploy
# mvn -Pgpg -Prelease nexus-staging:close -DstagingDescription="closing to release"
env:
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Create release
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && contains('true', github.event.inputs.release))
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844
with:
draft: true
generate_release_notes: true
fail_on_unmatched_files: true
files: |
metaschema-cli/target/metaschema-cli-*-metaschema-cli.*
# -------------------------
# Maven Site
# -------------------------
- name: Build Website
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && contains('true', github.event.inputs.website))
run: |
mvn -B -e -Prelease -Preporting install site site:stage
- name: Website Deploy
uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && contains('true', github.event.inputs.website))
with:
personal_token: ${{ secrets.COMMIT_TOKEN }}
publish_dir: ./target/staging
publish_branch: ${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.pages-branch) || 'nist-pages' }}