Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add github actions workflow #7

Merged
merged 1 commit into from
Nov 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
74 changes: 74 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: CI

on:
push:
branches: main
paths-ignore:
- 'README.md'
pull_request:
branches: main
paths-ignore:
- 'README.md'

jobs:
build:
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobsjob_idif
if: github.repository == 'release-engineering/opentelemetry-ext-cli-java' && github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Set up Maven
uses: stCarolas/setup-maven@v4
with:
maven-version: ${{ matrix.maven }}
- name: Build with Maven
run: mvn -B -V install
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
- name: Codecov
uses: codecov/codecov-action@v2

snapshot:
if: github.repository == 'release-engineering/opentelemetry-ext-cli-java' && github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
# https://github.com/marketplace/actions/maven-setings-action
- name: Maven Settings
uses: s4u/maven-settings-action@v2
with:
sonatypeSnapshots: true
githubServer: false
servers: |
[{
"id": "sonatype-nexus-snapshots",
"username": "${{ secrets.SONATYPE_USERNAME }}",
"password": "${{ secrets.SONATYPE_PASSWORD }}"
}]
- name: Deploy Snapshot
run: mvn -B -V org.apache.maven.plugins:maven-source-plugin:jar-no-fork deploy