Skip to content

Commit 6d23922

Browse files
Merge pull request #139 from skyflowapi/SK-1786-common-workflow-for-v2
SK-1786 common workflow for internal and public release
2 parents 273851f + 525bbb8 commit 6d23922

4 files changed

Lines changed: 150 additions & 97 deletions

File tree

.github/workflows/internal-release.yml

Lines changed: 11 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -9,61 +9,14 @@ on:
99
- release/*
1010

1111
jobs:
12-
publish:
13-
runs-on: ubuntu-latest
14-
steps:
15-
- uses: actions/checkout@v2
16-
with:
17-
ref: ${{ github.ref_name }}
18-
fetch-depth: 0
19-
20-
- name: Set up Jfrog artifactory
21-
uses: actions/setup-java@v1
22-
with:
23-
java-version: '1.8'
24-
distribution: 'adopt'
25-
server-id: central
26-
server-username: JFROG_USERNAME
27-
server-password: JFROG_PASSWORD
28-
gpg-private-key: ${{ secrets.JFROG_GPG_KEY }} # Value of the GPG private key to import
29-
gpg-passphrase: JFROG_GPG_PASSPHRASE # env variable for GPG private key passphrase
30-
31-
- name: Get Previous tag
32-
id: previoustag
33-
uses: WyriHaximus/github-action-get-previous-tag@v1
34-
with:
35-
fallback: 1.0.0
36-
37-
- name: Bump Version
38-
run: |
39-
chmod +x ./scripts/bump_version.sh
40-
./scripts/bump_version.sh "${{ steps.previoustag.outputs.tag }}" "$(git rev-parse --short "$GITHUB_SHA")"
41-
42-
- name: Commit changes
43-
run: |
44-
git config user.name ${{ github.actor }}
45-
git config user.email ${{ github.actor }}@users.noreply.github.com
46-
git add pom.xml
47-
git commit -m "[AUTOMATED] Private Release ${{ steps.previoustag.outputs.tag }}-dev.$(git rev-parse --short $GITHUB_SHA)"
48-
git push origin -f
49-
50-
- name: Create env
51-
id: create-env
52-
run: |
53-
touch .env
54-
echo SKYFLOW_CREDENTIALS=${{ secrets.SKYFLOW_CREDENTIALS }} >> .env
55-
echo TEST_EXPIRED_TOKEN=${{ secrets.TEST_EXPIRED_TOKEN }} >> .env
56-
57-
- name: Create credentials json
58-
id: create-json
59-
uses: jsdaniell/create-json@1.1.2
60-
with:
61-
name: "credentials.json"
62-
json: ${{ secrets.TEST_CREDENTIALS_FILE_STRING }}
63-
64-
- name: Publish package to Jfrog Artifactory
65-
run: mvn clean deploy -P jfrog
66-
env:
67-
JFROG_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
68-
JFROG_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
69-
JFROG_GPG_PASSPHRASE: ${{ secrets.JFROG_GPG_PASSPHRASE }}
12+
build-and-deploy:
13+
uses: ./.github/workflows/shared-build-and-deploy.yml
14+
with:
15+
ref: ${{ github.ref_name }}
16+
is-internal: true
17+
server-id: central
18+
server-username: ${{ secrets.ARTIFACTORY_USERNAME }}
19+
server-password: ${{ secrets.ARTIFACTORY_PASSWORD }}
20+
gpg-key: ${{ secrets.JFROG_GPG_KEY }}
21+
gpg-passphrase: ${{ secrets.JFROG_GPG_PASSPHRASE }}
22+
profile: jfrog

.github/workflows/release.yml

Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,14 @@ on:
33
push:
44
tags: '*.*.*'
55
jobs:
6-
publish:
7-
runs-on: ubuntu-latest
8-
steps:
9-
- uses: actions/checkout@v1
10-
- name: Set up Maven Central Repository
11-
uses: actions/setup-java@v1
12-
with:
13-
java-version: '1.8'
14-
distribution: 'adopt'
15-
server-id: ossrh
16-
server-username: MAVEN_USERNAME
17-
server-password: MAVEN_PASSWORD
18-
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
19-
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
20-
21-
- name: create-json
22-
id: create-json
23-
uses: jsdaniell/create-json@1.1.2
24-
with:
25-
name: "credentials.json"
26-
json: ${{ secrets.TEST_CREDENTIALS_FILE_STRING }}
27-
28-
- name: Publish package to Maven Central
29-
run: mvn --batch-mode deploy -P maven-central
30-
env:
31-
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
32-
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
33-
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
6+
build-and-deploy:
7+
uses: ./.github/workflows/shared-build-and-deploy.yml
8+
with:
9+
ref: ${{ github.ref_name }}
10+
is-internal: false
11+
server-id: ossrh
12+
server-username: ${{ secrets.OSSRH_USERNAME }}
13+
server-password: ${{ secrets.OSSRH_PASSWORD }}
14+
gpg-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
15+
gpg-passphrase: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
16+
profile: maven-central
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: Shared Build and Deploy
2+
on:
3+
workflow_call:
4+
inputs:
5+
ref:
6+
description: 'Git reference to use (e.g., main or branch name)'
7+
required: true
8+
type: string
9+
10+
is-internal:
11+
description: 'Flag for internal release'
12+
required: true
13+
type: boolean
14+
15+
server-id:
16+
description: 'Id of the repository'
17+
required: true
18+
type: string
19+
20+
server-username:
21+
description: 'Username of the repository'
22+
required: true
23+
type: string
24+
25+
server-password:
26+
description: 'Password of the repository'
27+
required: true
28+
type: string
29+
30+
gpg-key:
31+
description: 'GPG key to access the repository'
32+
required: true
33+
type: string
34+
35+
gpg-passphrase:
36+
description: 'GPG passphrase to access the repository'
37+
required: true
38+
type: string
39+
40+
profile:
41+
description: 'Profile to pick from pom.xml'
42+
required: true
43+
type: string
44+
45+
jobs:
46+
publish:
47+
runs-on: ubuntu-latest
48+
steps:
49+
- uses: actions/checkout@v2
50+
with:
51+
ref: ${{ inputs.ref }}
52+
fetch-depth: 0
53+
54+
- name: Set up maven or jfrog repository
55+
uses: actions/setup-java@v1
56+
with:
57+
java-version: '1.8'
58+
distribution: 'adopt'
59+
server-id: ${{ inputs.server-id }}
60+
server-username: SERVER_USERNAME
61+
server-password: SERVER_PASSWORD
62+
gpg-private-key: ${{ inputs.gpg-key }} # Value of the GPG private key to import
63+
gpg-passphrase: GPG_PASSPHRASE # env variable for GPG private key passphrase
64+
65+
- name: Get Previous tag
66+
id: previoustag
67+
uses: WyriHaximus/github-action-get-previous-tag@v1
68+
with:
69+
fallback: 1.0.0
70+
71+
- name: Bump Version
72+
run: |
73+
chmod +x ./ci-scripts/bump_version.sh
74+
if ${{ inputs.is-internal }}; then
75+
./ci-scripts/bump_version.sh "${{ steps.previoustag.outputs.tag }}" "$(git rev-parse --short "$GITHUB_SHA")"
76+
else
77+
./ci-scripts/bump_version.sh "${{ steps.previoustag.outputs.tag }}"
78+
fi
79+
80+
- name: Commit changes
81+
run: |
82+
git config user.name ${{ github.actor }}
83+
git config user.email ${{ github.actor }}@users.noreply.github.com
84+
git add pom.xml
85+
if ${{ inputs.is-internal }}; then
86+
git commit -m "[AUTOMATED] Private Release ${{ steps.previoustag.outputs.tag }}-dev-$(git rev-parse --short $GITHUB_SHA)"
87+
git push origin ${{ github.ref_name }} -f
88+
else
89+
git commit -m "[AUTOMATED] Public Release - ${{ steps.previoustag.outputs.tag }}"
90+
git push origin
91+
92+
- name: Create env
93+
if: ${{ inputs.is-internal }}
94+
id: create-env
95+
run: |
96+
touch .env
97+
echo SKYFLOW_CREDENTIALS=${{ secrets.SKYFLOW_CREDENTIALS }} >> .env
98+
echo TEST_EXPIRED_TOKEN=${{ secrets.TEST_EXPIRED_TOKEN }} >> .env
99+
100+
- name: Create credentials json
101+
id: create-json
102+
uses: jsdaniell/create-json@1.1.2
103+
with:
104+
name: "credentials.json"
105+
json: ${{ secrets.TEST_CREDENTIALS_FILE_STRING }}
106+
107+
- name: Publish package
108+
run: mvn clean deploy -P ${{ inputs.profile }}
109+
env:
110+
SERVER_USERNAME: ${{ inputs.server-username }}
111+
SERVER_PASSWORD: ${{ inputs.server-password }}
112+
GPG_PASSPHRASE: ${{ inputs.gpg-passphrase }}
113+

pom.xml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -121,17 +121,6 @@
121121

122122
<build>
123123
<plugins>
124-
<!-- <plugin>-->
125-
<!-- <groupId>org.sonatype.plugins</groupId>-->
126-
<!-- <artifactId>nexus-staging-maven-plugin</artifactId>-->
127-
<!-- <version>1.6.7</version>-->
128-
<!-- <extensions>true</extensions>-->
129-
<!-- <configuration>-->
130-
<!-- <serverId>ossrh</serverId>-->
131-
<!-- <nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>-->
132-
<!-- <autoReleaseAfterClose>true</autoReleaseAfterClose>-->
133-
<!-- </configuration>-->
134-
<!-- </plugin>-->
135124
<plugin>
136125
<groupId>org.apache.maven.plugins</groupId>
137126
<artifactId>maven-source-plugin</artifactId>
@@ -255,6 +244,21 @@
255244
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
256245
</snapshotRepository>
257246
</distributionManagement>
247+
<build>
248+
<plugins>
249+
<plugin>
250+
<groupId>org.sonatype.plugins</groupId>
251+
<artifactId>nexus-staging-maven-plugin</artifactId>
252+
<version>1.6.7</version>
253+
<extensions>true</extensions>
254+
<configuration>
255+
<serverId>ossrh</serverId>
256+
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
257+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
258+
</configuration>
259+
</plugin>
260+
</plugins>
261+
</build>
258262
</profile>
259263
<profile>
260264
<id>jfrog</id>

0 commit comments

Comments
 (0)