-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
81 lines (78 loc) · 3.02 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
80
81
name: "Liferay Upgrade"
description: "Create a new branch and pull request if a new Liferay version is available"
author: "lgdd"
branding:
icon: "git-branch"
color: "blue"
inputs:
java-version:
description: >
Java version (default: '11')
Check Liferay compatibility matrix: https://www.liferay.com/compatibility-matrix.
required: true
default: "11"
java-distribution:
description: >
Java distribution (default: 'zulu')
List of supported distributions for the setup-java action: https://github.com/actions/setup-java#supported-distributions
Also check Liferay compatibility matrix: https://www.liferay.com/compatibility-matrix
required: true
default: "zulu"
workspace-directory:
description: >
Path to your workspace if different from root directory.
It will be use in this actions steps for the 'working-directory' directive.
required: false
default: .
runs:
using: composite
steps:
- name: Get Liferay Info
id: get-liferay-info
uses: lgdd/get-liferay-info-action@v1
with:
workspace-directory: ${{ inputs.workspace-directory }}
- name: Set Upgrade Branch Name
uses: actions/github-script@v7
env:
LFR_LATEST_PRODUCT_NAME: ${{ steps.get-liferay-info.outputs.latest-product-name }}
with:
script: |
const { LFR_LATEST_PRODUCT_NAME } = process.env;
const upgradeBranchName = `upgrade-to-${LFR_LATEST_PRODUCT_NAME.replaceAll('.', '')}`;
core.exportVariable("UPGRADE_BRANCH_NAME", upgradeBranchName)
- shell: bash
run: |
NO_UPGRADE_BRANCH=$(git ls-remote -q | grep -q '${{ env.UPGRADE_BRANCH_NAME }}' && echo false || echo true)
echo "NO_UPGRADE_BRANCH=$NO_UPGRADE_BRANCH" >> $GITHUB_ENV
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: ${{ inputs.java-distribution }}
java-version: ${{ inputs.java-version }}
- name: Cache Gradle Packages
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- uses: actions/setup-go@v5
with:
go-version: ">=1.20.0"
- run: go build -C ${{ github.action_path }} -o go-upgrade
shell: bash
working-directory: ${{ inputs.workspace-directory }}
- run: cp ${{ github.action_path }}/go-upgrade . && chmod +x go-upgrade
shell: bash
working-directory: ${{ inputs.workspace-directory }}
- run: ./go-upgrade
shell: bash
working-directory: ${{ inputs.workspace-directory }}
env:
GH_TOKEN: ${{ github.token }}
LFR_CURRENT_PRODUCT_NAME: ${{ steps.get-liferay-info.outputs.current-product-name }}
LFR_LATEST_PRODUCT_NAME: ${{ steps.get-liferay-info.outputs.latest-product-name }}
LFR_LATEST_PRODUCT_VERSION_NAME: ${{ steps.get-liferay-info.outputs.latest-product-version-name }}