forked from MineInAbyss/publish-action
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaction.yml
79 lines (72 loc) · 2.65 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: 'Publish Oraxen packages'
description: 'Publishes to our maven repo, documentation, and release jars'
inputs:
maven-metadata-url:
description: 'The URL to the maven-metadata.xml file to get latest version from'
required: true
pages-path:
description: 'The path to publish to GitHub Pages'
required: false
default: ''
dokka:
description: 'The type of dokka build to run'
required: false
default: ''
release-files:
description: 'The files to attach to the release'
required: false
default: ''
maven-username:
description: 'The username of the repository to publish to'
required: true
maven-password:
description: 'The password of the repository to publish to'
required: true
snapshot-branch:
description: 'When the workflow runs on this branch, publish to snapshots instead of releases'
required: false
default: 'develop'
runs:
using: "composite"
steps:
- shell: bash
run: echo "IS_SNAPSHOT=${{github.ref == format('refs/heads/{0}', inputs.snapshot-branch)}}" >> $GITHUB_ENV
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
cache: gradle
- name: Set env variable for latest maven version
shell: bash
run: |
VERSION=$(curl -S -s ${{ inputs.maven-metadata-url }} 2>/dev/null | grep -oP '(?<=<latest>)(.*?)(?=<\/latest>)' || echo "0")
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
- name: Run gradle build and publish
shell: bash
run: >
gradle build publish
-PoraxenMavenUsername=${{ inputs.maven-username }} -PoraxenMavenPassword=${{ inputs.maven-password }} -Pplugin_path=${{ github.workspace }}/publish
- name: Build with dokka
shell: bash
run: gradle ${{ inputs.dokka }}
if: ${{ inputs.dokka != '' && env.IS_SNAPSHOT == false }}
- name: Get version from gradle
shell: bash
id: extract_version
run: |
echo "BUMPED_VERSION"=$(gradle properties --console=plain -q | grep "^version:" | awk '{printf $2}') >> $GITHUB_ENV
if: ${{ inputs.release-files != '' }}
- name: Create GitHub Release
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ github.token }}"
prerelease: ${{ env.IS_SNAPSHOT }}
automatic_release_tag: v${{ env.BUMPED_VERSION }}
files: ${{ inputs.release-files }}
if: ${{ inputs.release-files != '' }}
- name: Upload github pages artifact
uses: actions/upload-pages-artifact@v1
with:
path: ${{ inputs.pages-path }}
if: ${{ inputs.pages-path != '' && env.IS_SNAPSHOT == false }}