-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
203 additions
and
142 deletions.
There are no files selected for viewing
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,76 +1,32 @@ | ||
# | ||
# Copyright 2021 The ModiTect authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
name: Build | ||
|
||
name: Build & Release | ||
|
||
on: [push, pull_request] | ||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.event.head_commit.message, 'Releasing version') != true | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v2.3.4 | ||
|
||
- name: Setup Java | ||
uses: actions/setup-java@v1 | ||
uses: actions/setup-java@v1.4.3 | ||
with: | ||
java-version: 1.8 | ||
|
||
- name: Cache Maven | ||
uses: actions/cache@v1 | ||
uses: actions/cache@v2.1.4 | ||
with: | ||
path: ~/.m2 | ||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: ${{ runner.os }}-m2 | ||
|
||
- name: Build | ||
run: | | ||
chmod +x mvnw | ||
./mvnw -B verify --file pom.xml | ||
release: | ||
name: Release | ||
needs: build | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'push' && startsWith(github.event.head_commit.message, '[release]') | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Java | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 1.8 | ||
server-id: central | ||
server-username: MAVEN_USERNAME | ||
server-password: MAVEN_CENTRAL_TOKEN | ||
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} | ||
gpg-passphrase: MAVEN_GPG_PASSPHRASE | ||
|
||
- name: Release | ||
env: | ||
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | ||
MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_PASSWORD }} | ||
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | ||
run: | | ||
export GPG_TTY=$(tty) | ||
git config user.name "${{ github.event.head_commit.committer.name }}" | ||
git config user.email "${{ github.event.head_commit.committer.email }}" | ||
mvn -B --file pom.xml release:prepare release:perform -Drepository.url=https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git | ||
run: ./mvnw --no-transfer-progress -B --file pom.xml verify |
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,47 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Version | ||
id: version | ||
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/} | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v2.3.4 | ||
|
||
- name: Cache Maven | ||
uses: actions/cache@v2.1.4 | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: ${{ runner.os }}-m2 | ||
|
||
- name: Setup Java | ||
uses: actions/setup-java@v1.4.3 | ||
with: | ||
java-version: 1.8 | ||
server-id: central | ||
server-username: MAVEN_USERNAME | ||
server-password: MAVEN_CENTRAL_TOKEN | ||
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} | ||
gpg-passphrase: MAVEN_GPG_PASSPHRASE | ||
|
||
- name: Release | ||
env: | ||
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | ||
MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_PASSWORD }} | ||
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | ||
run: | | ||
export GPG_TTY=$(tty) | ||
./mvnw --no-transfer-progress -B --file pom.xml \ | ||
-Drepository.url=https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git \ | ||
-Dmaven.site.skip=true -Drelease=true deploy |
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,75 @@ | ||
name: Trigger | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
branch: | ||
description: "Branch to release from" | ||
required: true | ||
default: "main" | ||
version: | ||
description: "Release version" | ||
required: true | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2.3.4 | ||
|
||
- name: Setup Java | ||
uses: actions/setup-java@v1.4.3 | ||
with: | ||
java-version: 1.8 | ||
|
||
- name: Cache Maven | ||
uses: actions/cache@v2.1.4 | ||
with: | ||
path: ~/.m2 | ||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: ${{ runner.os }}-m2 | ||
|
||
- name: Build | ||
run: ./mvnw --no-transfer-progress -B --file pom.xml verify | ||
|
||
tag: | ||
name: Tag | ||
needs: build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v2.3.4 | ||
with: | ||
# required for triggering release workflow on tagging | ||
token: ${{ secrets.GIT_ACCESS_TOKEN }} | ||
|
||
- name: Setup Java | ||
uses: actions/setup-java@v1.4.3 | ||
with: | ||
java-version: 1.8 | ||
|
||
- name: Cache Maven | ||
uses: actions/cache@v2.1.4 | ||
with: | ||
path: ~/.m2 | ||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: ${{ runner.os }}-m2 | ||
|
||
- name: Create tag | ||
run: | | ||
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* | ||
BRANCH=${{ github.event.inputs.branch }} | ||
VERSION=${{ github.event.inputs.version }} | ||
echo "Releasing $VERSION from $BRANCH branch" | ||
git checkout $BRANCH | ||
./mvnw -B versions:set versions:commit -DnewVersion=$VERSION | ||
git config --global user.email "moditect-release-bot@moditect.org" | ||
git config --global user.name "moditect-release-bot" | ||
git commit -a -m "Releasing version $VERSION" | ||
git tag v$VERSION | ||
git push origin $BRANCH | ||
git push origin v$VERSION |
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
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,13 +1,15 @@ | ||
Copyright 2021 The ModiTect authors | ||
SPDX-License-Identifier: Apache-2.0 | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
Copyright ${project.inceptionYear} The ModiTect authors. | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
https://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
Oops, something went wrong.