Skip to content

Commit

Permalink
Added release workflow (opensearch-project#163)
Browse files Browse the repository at this point in the history
* Added release workflow

* Modified upload release action and java version
  • Loading branch information
gaiksaya authored Mar 28, 2020
1 parent 9a367c7 commit 65e4be8
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 1 deletion.
104 changes: 104 additions & 0 deletions .github/workflows/release-workflow.yml
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
2 changes: 1 addition & 1 deletion .github/workflows/test-and-build-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
steps:
# This step uses the checkout Github action: https://github.com/actions/checkout
- name: Checkout Branch
uses: actions/checkout@v1
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
Expand Down

0 comments on commit 65e4be8

Please sign in to comment.