From 6cde1bed7f4bff245cbe3fc2869b912c150aa831 Mon Sep 17 00:00:00 2001 From: FinsaasGH <89403560+FinsaasGH@users.noreply.github.com> Date: Wed, 7 Sep 2022 07:24:59 -0600 Subject: [PATCH 1/4] feature: modified s3-release to run on successful ci-matrix, and conditionally upload to versioned bucket --- .github/workflows/ci-matrix.yml | 14 +++-- .github/workflows/s3-release.yml | 100 +++++++++++++------------------ 2 files changed, 51 insertions(+), 63 deletions(-) diff --git a/.github/workflows/ci-matrix.yml b/.github/workflows/ci-matrix.yml index b42e0180b..e21ffe641 100644 --- a/.github/workflows/ci-matrix.yml +++ b/.github/workflows/ci-matrix.yml @@ -2,7 +2,7 @@ name: ci-matrix on: pull_request: - types: [opened, synchronize] + types: [opened, reopened, synchronize] branches: - master @@ -13,7 +13,7 @@ jobs: matrix: target: - { name: linux, os: ubuntu-latest } - - { name: macos, os: macOS-latest } + - { name: macos, os: macos-latest } - { name: windows, os: windows-latest } name: Build node on ${{ matrix.target.os }} @@ -25,8 +25,14 @@ jobs: env: cache-name: cache-node-modules with: - path: ~/.cargo/cache - key: ${{ runner.os }}-0001 + path: | + ~/.cargo/cache/ + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Build ${{ matrix.target.os }} run: | rustup check diff --git a/.github/workflows/s3-release.yml b/.github/workflows/s3-release.yml index 9a6a24f23..e70a1e8cc 100644 --- a/.github/workflows/s3-release.yml +++ b/.github/workflows/s3-release.yml @@ -1,69 +1,51 @@ name: s3-release on: - push: - branches: - - master - - 'releases/**' - tags: - - v* + workflow_run: + workflows: [ci-matrix] + types: + - completed jobs: - build: - strategy: - fail-fast: false - matrix: - target: - - { name: linux, os: ubuntu-latest } - - { name: macos, os: macOS-latest } - - { name: windows, os: windows-latest } - - name: Build node on ${{ matrix.target.os }} - runs-on: ${{ matrix.target.os }} - steps: - - uses: actions/checkout@v3 - - name: Cache sccache results - uses: actions/cache@v3 - env: - cache-name: cache-node-modules - with: - path: ~/.cargo/cache - key: ${{ runner.os }}-0001 - - name: Build ${{ matrix.target.os }} - run: | - rustup check - case "$OSTYPE" in - msys) - echo "Windows doesn't like it when rustup updates itself" - rustup update --no-self-update stable - ;; - *) - echo "Linux and macOS don't need manual suppression of rustup self update" - rustup update stable - ;; - esac - rustup check - rustup component add rustfmt - rustup component add clippy - ./ci/all.sh - ./ci/multinode_integration_test.sh - ./ci/collect_results.sh - shell: bash - - name: Publish ${{ matrix.target.os }} - uses: actions/upload-artifact@v3 - with: - name: Node-${{ matrix.target.name }} - path: results/generated/bin - deploy_to_s3: - needs: ["build"] + deploy_to_versioned_s3: + if: startsWith(github.head_ref, 'v*') != true runs-on: ubuntu-latest steps: - - uses: actions/download-artifact@v3 - id: download + - uses: actions/checkout@v3 + - name: Download artifacts from PR + run: | + mkdir download + cd download + gh run download ${{ github.event.workflow_run.id }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Display structure of downloaded files + run: ls -R download + - name: S3 Sync + uses: jakejarvis/s3-sync-action@v0.5.1 + with: + args: --acl private --follow-symlinks --delete + env: + AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_REGION: 'us-west-2' + DEST_DIR: 'Node/${{ github.head_ref }}' + SOURCE_DIR: download + deploy_to_latest_s3: + if: startsWith(github.head_ref, 'v*') == true + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - name: Download artifacts from PR + run: | + mkdir download + cd download + gh run download ${{ github.event.workflow_run.id }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Display structure of downloaded files - run: ls -R - - name: 'Echo download path' - run: echo ${{steps.download.outputs.download-path}} + run: ls -R download - name: S3 Sync uses: jakejarvis/s3-sync-action@v0.5.1 with: @@ -74,4 +56,4 @@ jobs: AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_REGION: 'us-west-2' DEST_DIR: 'Node/latest' - SOURCE_DIR: ${{ steps.download.outputs.download-path }} + SOURCE_DIR: download From 83bc4cc784153f68e1893942a8a7df33ff00b439 Mon Sep 17 00:00:00 2001 From: FinsaasGH <89403560+FinsaasGH@users.noreply.github.com> Date: Wed, 7 Sep 2022 07:27:48 -0600 Subject: [PATCH 2/4] [skip ci] updated runs-on in s3-release --- .github/workflows/s3-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/s3-release.yml b/.github/workflows/s3-release.yml index e70a1e8cc..9afc4d5ff 100644 --- a/.github/workflows/s3-release.yml +++ b/.github/workflows/s3-release.yml @@ -34,7 +34,7 @@ jobs: SOURCE_DIR: download deploy_to_latest_s3: if: startsWith(github.head_ref, 'v*') == true - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Download artifacts from PR From faa0a0ee28f6e682a04d7a79eb1df229ebd11ae0 Mon Sep 17 00:00:00 2001 From: FinsaasGH <89403560+FinsaasGH@users.noreply.github.com> Date: Wed, 7 Sep 2022 07:31:56 -0600 Subject: [PATCH 3/4] Update s3-release.yml --- .github/workflows/s3-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/s3-release.yml b/.github/workflows/s3-release.yml index 9afc4d5ff..392420473 100644 --- a/.github/workflows/s3-release.yml +++ b/.github/workflows/s3-release.yml @@ -32,6 +32,7 @@ jobs: AWS_REGION: 'us-west-2' DEST_DIR: 'Node/${{ github.head_ref }}' SOURCE_DIR: download + deploy_to_latest_s3: if: startsWith(github.head_ref, 'v*') == true runs-on: ubuntu-latest From f5a75600f1f183c5610d1d451fff836b50af24a8 Mon Sep 17 00:00:00 2001 From: FinsaasGH <89403560+FinsaasGH@users.noreply.github.com> Date: Sun, 11 Sep 2022 16:03:15 -0600 Subject: [PATCH 4/4] fix: added cloudfront invalidation step to s3-release.yml --- .github/workflows/s3-release.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/s3-release.yml b/.github/workflows/s3-release.yml index 392420473..b085876b8 100644 --- a/.github/workflows/s3-release.yml +++ b/.github/workflows/s3-release.yml @@ -58,3 +58,11 @@ jobs: AWS_REGION: 'us-west-2' DEST_DIR: 'Node/latest' SOURCE_DIR: download + - name: Invalidate Binaries CloudFront + uses: chetan/invalidate-cloudfront-action@v2.3 + env: + DISTRIBUTION: ${{ secrets.DISTRIBUTION }} + PATHS: "/Node*" + AWS_REGION: "us-west-2" + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}