Skip to content

Commit 31ab8e7

Browse files
authored
Workflow changes (#172)
* feature: modified s3-release to run on successful ci-matrix, and conditionally upload to versioned bucket * [skip ci] updated runs-on in s3-release * Update s3-release.yml * fix: added cloudfront invalidation step to s3-release.yml
1 parent e6163af commit 31ab8e7

File tree

2 files changed

+60
-63
lines changed

2 files changed

+60
-63
lines changed

.github/workflows/ci-matrix.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: ci-matrix
22

33
on:
44
pull_request:
5-
types: [opened, synchronize]
5+
types: [opened, reopened, synchronize]
66
branches:
77
- master
88

@@ -13,7 +13,7 @@ jobs:
1313
matrix:
1414
target:
1515
- { name: linux, os: ubuntu-latest }
16-
- { name: macos, os: macOS-latest }
16+
- { name: macos, os: macos-latest }
1717
- { name: windows, os: windows-latest }
1818

1919
name: Build node on ${{ matrix.target.os }}
@@ -25,8 +25,14 @@ jobs:
2525
env:
2626
cache-name: cache-node-modules
2727
with:
28-
path: ~/.cargo/cache
29-
key: ${{ runner.os }}-0001
28+
path: |
29+
~/.cargo/cache/
30+
~/.cargo/bin/
31+
~/.cargo/registry/index/
32+
~/.cargo/registry/cache/
33+
~/.cargo/git/db/
34+
target/
35+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
3036
- name: Build ${{ matrix.target.os }}
3137
run: |
3238
rustup check

.github/workflows/s3-release.yml

Lines changed: 50 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,52 @@
11
name: s3-release
22

33
on:
4-
push:
5-
branches:
6-
- master
7-
- 'releases/**'
8-
tags:
9-
- v*
4+
workflow_run:
5+
workflows: [ci-matrix]
6+
types:
7+
- completed
108

119
jobs:
12-
build:
13-
strategy:
14-
fail-fast: false
15-
matrix:
16-
target:
17-
- { name: linux, os: ubuntu-latest }
18-
- { name: macos, os: macOS-latest }
19-
- { name: windows, os: windows-latest }
20-
21-
name: Build node on ${{ matrix.target.os }}
22-
runs-on: ${{ matrix.target.os }}
23-
steps:
24-
- uses: actions/checkout@v3
25-
- name: Cache sccache results
26-
uses: actions/cache@v3
27-
env:
28-
cache-name: cache-node-modules
29-
with:
30-
path: ~/.cargo/cache
31-
key: ${{ runner.os }}-0001
32-
- name: Build ${{ matrix.target.os }}
33-
run: |
34-
rustup check
35-
case "$OSTYPE" in
36-
msys)
37-
echo "Windows doesn't like it when rustup updates itself"
38-
rustup update --no-self-update stable
39-
;;
40-
*)
41-
echo "Linux and macOS don't need manual suppression of rustup self update"
42-
rustup update stable
43-
;;
44-
esac
45-
rustup check
46-
rustup component add rustfmt
47-
rustup component add clippy
48-
./ci/all.sh
49-
./ci/multinode_integration_test.sh
50-
./ci/collect_results.sh
51-
shell: bash
52-
- name: Publish ${{ matrix.target.os }}
53-
uses: actions/upload-artifact@v3
54-
with:
55-
name: Node-${{ matrix.target.name }}
56-
path: results/generated/bin
57-
deploy_to_s3:
58-
needs: ["build"]
10+
deploy_to_versioned_s3:
11+
if: startsWith(github.head_ref, 'v*') != true
5912
runs-on: ubuntu-latest
6013
steps:
61-
- uses: actions/download-artifact@v3
62-
id: download
14+
- uses: actions/checkout@v3
15+
- name: Download artifacts from PR
16+
run: |
17+
mkdir download
18+
cd download
19+
gh run download ${{ github.event.workflow_run.id }}
20+
env:
21+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6322
- name: Display structure of downloaded files
64-
run: ls -R
65-
- name: 'Echo download path'
66-
run: echo ${{steps.download.outputs.download-path}}
23+
run: ls -R download
24+
- name: S3 Sync
25+
uses: jakejarvis/[email protected]
26+
with:
27+
args: --acl private --follow-symlinks --delete
28+
env:
29+
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
30+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
31+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
32+
AWS_REGION: 'us-west-2'
33+
DEST_DIR: 'Node/${{ github.head_ref }}'
34+
SOURCE_DIR: download
35+
36+
deploy_to_latest_s3:
37+
if: startsWith(github.head_ref, 'v*') == true
38+
runs-on: ubuntu-latest
39+
steps:
40+
- uses: actions/checkout@v3
41+
- name: Download artifacts from PR
42+
run: |
43+
mkdir download
44+
cd download
45+
gh run download ${{ github.event.workflow_run.id }}
46+
env:
47+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
- name: Display structure of downloaded files
49+
run: ls -R download
6750
- name: S3 Sync
6851
uses: jakejarvis/[email protected]
6952
with:
@@ -74,4 +57,12 @@ jobs:
7457
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
7558
AWS_REGION: 'us-west-2'
7659
DEST_DIR: 'Node/latest'
77-
SOURCE_DIR: ${{ steps.download.outputs.download-path }}
60+
SOURCE_DIR: download
61+
- name: Invalidate Binaries CloudFront
62+
uses: chetan/[email protected]
63+
env:
64+
DISTRIBUTION: ${{ secrets.DISTRIBUTION }}
65+
PATHS: "/Node*"
66+
AWS_REGION: "us-west-2"
67+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
68+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

0 commit comments

Comments
 (0)