From cfd957149c8f6cb27984caea1f51f917ca3883ba Mon Sep 17 00:00:00 2001 From: Ruizhen Guo <55893852+rguo-aws@users.noreply.github.com> Date: Mon, 30 Mar 2020 18:31:50 -0700 Subject: [PATCH] Add cd.yml and enable CD pipeline to upload artifact to S3 (#90) * add cd.yml * upgrade ospackage version to 8.2.0 * change s3 * update cd.yml --- .github/workflows/cd.yml | 52 ++++++++++++++++++++++++++++++++++++++++ build.gradle | 2 +- 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/cd.yml diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 00000000..23476135 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,52 @@ +name: CD + +on: + push: + tags: + - 'v*' + +jobs: + build: + runs-on: ubuntu-latest + + steps: + + - name: Set up JDK 13 + uses: actions/setup-java@v1 + with: + java-version: 13.0.x + + - name: Checkout Performance Analyzer package + uses: actions/checkout@v2 + + - name: Build + run: | + ./gradlew build buildDeb buildRpm --refresh-dependencies -Dbuild.snapshot=false -x javadoc + mkdir artifacts + artifact=`ls build/distributions/*.zip` + rpm_artifact=`ls build/distributions/*.rpm` + deb_artifact=`ls build/distributions/*.deb` + cp $artifact artifacts/ + cp $rpm_artifact artifacts/ + cp $deb_artifact artifacts/ + + - 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 + + - name: Upload Artifacts to S3 + run: | + s3_path=s3://artifacts.opendistroforelasticsearch.amazon.com/downloads + aws s3 cp artifacts/*.zip $s3_path/elasticsearch-plugins/performance-analyzer/ + aws s3 cp artifacts/*.rpm $s3_path/rpms/opendistro-performance-analyzer/ + aws s3 cp artifacts/*.deb $s3_path/debs/opendistro-performance-analyzer/ + aws cloudfront create-invalidation --distribution-id ${{ secrets.DISTRIBUTION_ID }} --paths "/downloads/*" + + - name: Upload Workflow Artifacts + uses: actions/upload-artifact@v1 + with: + name: artifacts + path: artifacts/ \ No newline at end of file diff --git a/build.gradle b/build.gradle index 5c514f1d..a6d061c3 100644 --- a/build.gradle +++ b/build.gradle @@ -30,7 +30,7 @@ buildscript { plugins { id 'java' - id 'nebula.ospackage' version "8.0.1" + id 'nebula.ospackage' version "8.2.0" } ext {