-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add release and validation pipeline
- Loading branch information
danijelTxFusion
committed
Jan 9, 2024
1 parent
f57d5e0
commit aedd878
Showing
6 changed files
with
136 additions
and
7 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Release | ||
on: | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read # for checkout | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write # to be able to publish a GitHub release | ||
issues: write # to be able to comment on released issues | ||
pull-requests: write # to be able to comment on released pull requests | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "lts/*" | ||
- name: Install dependencies | ||
run: | | ||
npm install -g "[email protected]" \ | ||
"@semantic-release/[email protected]" \ | ||
"@semantic-release/[email protected]" \ | ||
"@semantic-release/[email protected]" \ | ||
"@semantic-release/[email protected]" | ||
- name: Release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: npx semantic-release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,20 @@ | ||
name: Test Java SDK library | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: | ||
- master | ||
push: | ||
branches: | ||
- develop | ||
branches: [master] | ||
types: [ opened, reopened, synchronize ] | ||
|
||
jobs: | ||
test: | ||
name: Test java project | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up JDK 8 | ||
- name: Set up JDK | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 1.8 | ||
java-version: 11 | ||
- name: Test with Gradle | ||
run: gradle clean test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Validate | ||
on: | ||
pull_request: | ||
branches: [master] | ||
types: [ opened, reopened, synchronize ] | ||
|
||
permissions: | ||
contents: read # for checkout | ||
|
||
jobs: | ||
lint: | ||
name: Check code format | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up JDK | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 11 | ||
- name: Test with Gradle | ||
run: gradle spotlessCheck | ||
commits: | ||
name: Check commits | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "lts/*" | ||
- name: Install dependencies | ||
run: npm install -g @commitlint/cli @commitlint/config-conventional | ||
- name: Configure | ||
run: | | ||
echo 'module.exports = {"extends": ["@commitlint/config-conventional"]}' > commitlint.config.js | ||
- name: Validate | ||
run: | | ||
git fetch | ||
npx commitlint \ | ||
--from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} \ | ||
--to ${{ github.event.pull_request.head.sha }} \ | ||
--verbose | ||
commits-fork: | ||
name: Check commits from forks | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "lts/*" | ||
- name: Install dependencies | ||
run: npm install -g @commitlint/cli @commitlint/config-conventional | ||
- name: Configure | ||
run: | | ||
echo 'module.exports = {"extends": ["@commitlint/config-conventional"]}' > commitlint.config.js | ||
- name: Validate | ||
run: | | ||
git fetch origin "+refs/pull/${{ github.event.pull_request.number }}/head:refs/pull/${{ github.event.pull_request.number }}/head" | ||
git checkout "refs/pull/${{ github.event.pull_request.number }}/head" | ||
npx commitlint \ | ||
--from HEAD~${{ github.event.pull_request.commits }} \ | ||
--to HEAD \ | ||
--verbose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"repositoryUrl": "https://github.com/zksync-sdk/zksync2-java.git", | ||
"branches": "main", | ||
"debug": true, | ||
"addReleases": "top", | ||
"preset": "angular", | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
[ | ||
"@semantic-release/changelog", | ||
{ | ||
"changelogFile": "CHANGELOG.md" | ||
} | ||
], | ||
[ | ||
"@semantic-release/git", | ||
{ | ||
"assets": ["CHANGELOG.md"], | ||
"message": "${nextRelease.version} version bump [skip ci]\n\n${nextRelease.notes}" | ||
} | ||
], | ||
"@semantic-release/github" | ||
] | ||
} |