Skip to content

Commit

Permalink
ci: backport github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
austince committed Jan 12, 2021
1 parent 52aacb2 commit 91664a7
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Commit
on: [push]
jobs:
build:
strategy:
fail-fast: false
matrix:
elasticsearch:
- 7.10.1
- 7.10.0
- 7.9.3
- 7.9.2
- 7.9.3
- 7.8.1
- 7.8.0
- 7.7.1
- 7.7.0
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 11
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build and test with Maven
env:
ELASTICSEARCH_VERSION: ${{ matrix.elasticsearch }}
run: mvn --batch-mode clean install "-Delasticsearch.version=${{ matrix.elasticsearch }}" --file pom.xml
79 changes: 79 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Create Release
on:
push:
tags:
- '*.*.*'
- '*.*.*-rc*'
jobs:
create_release:
name: Create Release
runs-on: ubuntu-20.04
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
# Generate the release changelog from commits since the last release
- name: Build Changelog
id: build_changelog
uses: mikepenz/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Create and upload assets to a release
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: ${{ contains('rc', github.ref) }}
body: ${{ steps.build_changelog.outputs.changelog }}
build_and_upload_artifacts:
name: Build and Upload Artifacts
needs: create_release
runs-on: ubuntu-20.04
strategy:
matrix:
elasticsearch:
- 7.10.1
- 7.10.0
- 7.9.3
- 7.9.2
- 7.9.3
- 7.8.1
- 7.8.0
- 7.7.1
- 7.7.0
steps:
- uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 11
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build with Maven
env:
ELASTICSEARCH_VERSION: ${{ matrix.elasticsearch }}
run: |
mvn --batch-mode clean package \
-Delasticsearch.version=${{ matrix.elasticsearch }} \
-Dzentity.version=${{ github.ref }} \
--file pom.xml
- name: Upload Release Asset
id: upload_release_asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# Pull from the create_release job above, referencing it's ID to get its outputs object, which include a `upload_url`.
# see: https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobsjob_idoutputs
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./target/releases//zentity-${{ github.ref }}-elasticsearch-${{ matrix.elasticsearch }}.zip
asset_name: zentity-${{ github.ref }}-elasticsearch-${{ matrix.elasticsearch }}.zip
asset_content_type: application/zip

0 comments on commit 91664a7

Please sign in to comment.