Skip to content
This repository was archived by the owner on Apr 12, 2025. It is now read-only.

Commit 2e8165a

Browse files
committed
workflows(release): record current release on kipher-core
1 parent 9a52f16 commit 2e8165a

4 files changed

Lines changed: 89 additions & 4 deletions

File tree

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939

4040
- name: Replace version on project gradle.properties
4141
run: |
42-
cd ${{ steps.module.outputs.module_name }}
42+
cd ${{ inputs.project }}
4343
sed -i "/^VERSION=/ s/=.*/=${{ inputs.version }}/" gradle.properties
4444
4545
- name: remove SNAPSHOT on root gradle.properties
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: record
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
project:
7+
description: "Project to update."
8+
type: string
9+
required: true
10+
version:
11+
description: "Version to rewrite in gradle.properties."
12+
type: string
13+
required: true
14+
15+
env:
16+
GRADLE_OPTS: -Dorg.gradle.jvmargs="-XX:MaxMetaspaceSize=2g"
17+
JDK_VERSION: 19
18+
19+
jobs:
20+
check:
21+
runs-on: ubuntu-latest
22+
outputs:
23+
check: ${{ steps.check.outputs.record }}
24+
25+
steps:
26+
- uses: actions/checkout@v3
27+
28+
- name: Check if module needs to be recorded
29+
id: check
30+
run: |
31+
# check if CURRENT_RELEASE is present in gradle.properties
32+
cd ${{ inputs.project }}
33+
34+
if grep -q "^CURRENT_RELEASE=" gradle.properties; then
35+
echo "CURRENT_RELEASE is present"
36+
echo "record=true" >> $GITHUB_OUTPUT
37+
else
38+
echo "CURRENT_RELEASE is not present"
39+
echo "record=false" >> $GITHUB_OUTPUT
40+
fi
41+
42+
record:
43+
needs: check
44+
if: needs.check.outputs.check == 'true'
45+
runs-on: ubuntu-latest
46+
47+
permissions:
48+
contents: write
49+
pull-requests: write
50+
51+
steps:
52+
- uses: actions/checkout@v3
53+
with:
54+
fetch-depth: 0
55+
56+
- name: Update previous release version
57+
run: |
58+
cd ${{ inputs.project }}
59+
sed -i "/^CURRENT_RELEASE=/ s/=.*/=${{ inputs.version }}/" gradle.properties
60+
61+
- name: Commit latest docs
62+
run: |
63+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
64+
git config --local user.name "github-actions[bot]"
65+
git commit -am "chore(gradle): record current release version [skip-ci]"
66+
67+
- name: Push to repository
68+
uses: ad-m/github-push-action@master
69+
with:
70+
github_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,15 @@ jobs:
4747
- name: remove SNAPSHOT on root gradle.properties
4848
run: sed -i '/^VERSION=/ s/-SNAPSHOT//' gradle.properties
4949

50-
# this avoids relying on snapshot dependency on kipher-core
50+
# this avoids relying on early-version snapshot dependency on kipher-core
5151
- name: remove SNAPSHOT suffix on kipher-core version
5252
if: ${{ steps.module.outputs.module_name }} != "kipher-core"
5353
run: |
5454
cd kipher-core
55-
sed -i '/^VERSION=/ s/-SNAPSHOT//' gradle.properties
55+
# remove VERSION from gradle.properties
56+
sed -i '/VERSION/d' gradle.properties
57+
# use CURRENT_RELEASE as VERSION
58+
sed -i "s/CURRENT_RELEASE/VERSION/" gradle.properties
5659
5760
- name: replace version on project gradle.properties
5861
run: |
@@ -82,7 +85,7 @@ jobs:
8285
uses: mindsers/changelog-reader-action@v2
8386
with:
8487
validation_level: warn
85-
version: ${{ steps.version_name.outputs.version }}
88+
version: ${{ steps.tag.outputs.version }}
8689
path: docs/CHANGELOG-${{ steps.module.outputs.module_name }}.md
8790

8891
- name: Create release
@@ -99,6 +102,14 @@ jobs:
99102
artifacts: |
100103
${{ steps.module.outputs.module_name }}/build/libs/*
101104
105+
record:
106+
needs: publish
107+
uses: ./.github/workflows/release-record.yml
108+
with:
109+
project: ${{ needs.publish.outputs.module_name }}
110+
version: ${{ needs.publish.outputs.version }}
111+
secrets: inherit
112+
102113
docs:
103114
needs: publish
104115
uses: ./.github/workflows/docs.yml

kipher-core/gradle.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
ARTIFACT_ID=kipher-core
22
VERSION=0.2.0-SNAPSHOT
33

4+
# This is used for the release process,
5+
# to avoid relying on early versions declared in VERSION.
6+
CURRENT_RELEASE=0.1.0
7+
48
POM_NAME=kipher-core
59
POM_DESCRIPTION=Common utility libraries used by other kipher modules.
610

0 commit comments

Comments
 (0)