Skip to content
This repository has been archived by the owner on Jul 2, 2022. It is now read-only.

Commit

Permalink
Compact workflow. (#77)
Browse files Browse the repository at this point in the history
* Update publish.yml

* Update publish.yml

* Update publish.yml
  • Loading branch information
portlek authored Oct 7, 2020
1 parent 9358307 commit e03c351
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,35 @@ name: publish

on:
pull_request:
types: [closed]
types: [ closed ]

jobs:
tag:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Get release label of the pull request.
uses: actions-ecosystem/action-release-label@v1
id: release-label

- name: Cancel if the the p.r. does not have the release labels.
if: ${{ steps.release-label.outputs.level == null }}
run: exit 1

- name: Cancel Previous Workflow Runs
uses: n1hility/cancel-previous-runs@v2.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/checkout@v2

- uses: actions-ecosystem/action-release-label@v1
id: release-label
if: ${{ github.event.pull_request.merged == true }}

- uses: actions-ecosystem/action-get-latest-tag@v1
- name: Get the latest tag.
uses: actions-ecosystem/action-get-latest-tag@v1
id: get-latest-tag
if: ${{ steps.release-label.outputs.level != null }}

- uses: actions-ecosystem/action-bump-semver@v1
- name: Bump and return the new version.
uses: actions-ecosystem/action-bump-semver@v1
id: bump-semver
if: ${{ steps.release-label.outputs.level != null }}
with:
current_version: ${{ steps.get-latest-tag.outputs.tag }}
level: ${{ steps.release-label.outputs.level }}
Expand All @@ -36,20 +41,20 @@ jobs:
java-version: 1.8

- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v3
id: import_gpg
with:
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}

- name: action turnstyle
uses: softprops/turnstyle@v0.1.3

- name: Generate settings.xml for Maven Builds
uses: whelk-io/maven-settings-xml-action@v12
with:
servers: '[{ "id": "oss.sonatype.org", "username": "${{ secrets.SONATYPE_USERNAME }}", "password": "${{ secrets.SONATYPE_PASSWORD }}"}]'

- name: action turnstyle
uses: softprops/turnstyle@v0.1.3

- name: Publish with Maven
run: |
[[ "${{ steps.bump-semver.outputs.new_version }}" =~ ^[0-9]+(\.[0-9]+)*$ ]] || exit -1
Expand All @@ -60,7 +65,6 @@ jobs:
- name: Create a Release
uses: actions/create-release@v1.1.4
if: ${{ steps.release-label.outputs.level != null }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down

0 comments on commit e03c351

Please sign in to comment.