forked from opensearch-project/index-management
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added release workflow (opensearch-project#163)
* Added release workflow * Modified upload release action and java version
- Loading branch information
Showing
2 changed files
with
105 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,104 @@ | ||
name: Release workflow | ||
# This workflow is triggered on creating tags to master or an opendistro release branch | ||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
java: [13] | ||
# Job name | ||
name: Build Index Management with JDK ${{ matrix.java }} | ||
# This job runs on Linux | ||
runs-on: ubuntu-latest | ||
steps: | ||
# This step uses the checkout Github action: https://github.com/actions/checkout | ||
- name: Checkout Branch | ||
uses: actions/checkout@v2 | ||
# This step uses the setup-java Github action: https://github.com/actions/setup-java | ||
- name: Set Up JDK ${{ matrix.java }} | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: ${{ matrix.java }} | ||
|
||
# Building zip, deb and rpm files | ||
- name: Build with Gradle | ||
run: ./gradlew build buildDeb buildRpm --no-daemon -Dbuild.snapshot=false | ||
|
||
- name: Create Artifact Path | ||
run: | | ||
mkdir -p index-management-artifacts | ||
cp ./build/distributions/*.zip index-management-artifacts | ||
cp ./build/distributions/*.deb index-management-artifacts | ||
cp ./build/distributions/*.rpm index-management-artifacts | ||
echo ::set-env name=TAG_VERSION::${GITHUB_REF/refs\/tags\//} | ||
# AWS authentication | ||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: us-west-2 | ||
|
||
# This step uses the upload-artifact Github action: https://github.com/actions/upload-artifact | ||
- name: Upload Artifacts to S3 | ||
run: | | ||
s3_path=s3://artifacts.opendistroforelasticsearch.amazon.com/downloads | ||
aws s3 cp index-management-artifacts/*.zip $s3_path/elasticsearch-plugins/opendistro-index-management/ | ||
aws s3 cp index-management-artifacts/*.deb $s3_path/debs/opendistro-index-management/ | ||
aws s3 cp index-management-artifacts/*.rpm $s3_path/rpms/opendistro-index-management/ | ||
aws cloudfront create-invalidation --distribution-id ${{ secrets.DISTRIBUTION_ID }} --paths '/downloads/*' | ||
- name: Create Github Draft Release | ||
id: create_release | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ env.TAG_VERSION }} | ||
draft: true | ||
prerelease: false | ||
|
||
# Upload the release with .zip as asset | ||
- name: Upload Release Asset | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_name: index-management-artifacts.zip | ||
asset_path: ./build/distributions/*.zip | ||
asset_content_type: application/zip | ||
|
||
# Upload the release with .rpm as asset | ||
- name: Upload Release Asset | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_name: index-management-artifacts.rpm | ||
asset_path: ./build/distributions/*.rpm | ||
asset_content_type: application/zip | ||
|
||
# Upload the release with .deb as asset | ||
- name: Upload Release Asset | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_name: index-management-artifacts.deb | ||
asset_path: ./build/distributions/*.deb | ||
asset_content_type: application/zip | ||
|
||
- name: Upload Workflow Artifacts | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: index-management-plugin | ||
path: index-management-artifacts |
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