Skip to content

Commit e820839

Browse files
committed
chore(skip-release): fix release
Signed-off-by: Stephane Bouchet <sbouchet@redhat.com>
1 parent 823e1db commit e820839

File tree

1 file changed

+31
-13
lines changed

1 file changed

+31
-13
lines changed

.github/workflows/release.yml

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ jobs:
1616
release:
1717
name: Publish
1818
runs-on: ubuntu-latest
19-
permissions:
20-
contents: write
21-
pull-requests: write
19+
2220
steps:
2321
# Check out current repository
2422
- name: Fetch Sources
@@ -36,6 +34,19 @@ jobs:
3634
- name: Setup Gradle
3735
uses: gradle/actions/setup-gradle@v4
3836

37+
- name: Set Release Version
38+
shell: bash
39+
run: |
40+
CURRENT_VERSION=$(grep "projectVersion=" gradle.properties | cut -d'=' -f2)
41+
NEW_VERSION=${{ inputs.release_version }}
42+
awk -v current="$CURRENT_VERSION" -v new="$NEW_VERSION" 'BEGIN {FS=OFS="="} $1 == "projectVersion" { $2 = new }1' gradle.properties > tmpfile && mv tmpfile gradle.properties
43+
echo "Release version: $NEW_VERSION"
44+
echo "PLUGIN_VERSION=${NEW_VERSION}" >> $GITHUB_ENV
45+
46+
# Build plugin
47+
- name: Build Plugin
48+
run: ./gradlew assemble build
49+
3950
- name: Tag Release
4051
env:
4152
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -50,21 +61,28 @@ jobs:
5061
git tag ${{ inputs.release_version }}
5162
git push origin ${{ inputs.release_version }}
5263
53-
- name: Set Release Version
54-
shell: bash
55-
run: |
56-
CURRENT_VERSION=$(grep "projectVersion=" gradle.properties | cut -d'=' -f2)
57-
NEW_VERSION=${{ inputs.release_version }}
58-
awk -v current="$CURRENT_VERSION" -v new="$NEW_VERSION" 'BEGIN {FS=OFS="="} $1 == "projectVersion" { $2 = new }1' gradle.properties > tmpfile && mv tmpfile gradle.properties
59-
echo "Release version: $NEW_VERSION"
60-
echo "PLUGIN_VERSION=${NEW_VERSION}" >> $GITHUB_ENV
64+
# Publish to Maven repo
65+
- name: Checkout Maven Repo
66+
uses: actions/checkout@v4
67+
with:
68+
ref: repository
69+
path: build/repository
6170

62-
# Publish the plugin to local release repo
63-
- name: Publish Library
71+
- name: Deploy to Maven Repository
72+
env:
73+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6474
run: |
75+
CURRENT_VERSION=$(grep "projectVersion=" gradle.properties | cut -d'=' -f2)
6576
./gradlew publish
6677
echo "Published $PLUGIN_VERSION."
6778
79+
git config --global user.email "action@github.com"
80+
git config --global user.name "GitHub Action Bot"
81+
pushd build/repository
82+
git add releases/
83+
git commit -m "Publish ${CURRENT_VERSION} (${{github.run_number}})"
84+
git push -f origin repository
85+
6886
# Set next SNAPSHOT version
6987
- name: Increment Plugin Version
7088
env:

0 commit comments

Comments
 (0)