mirror of
https://github.com/voltrevo/ValueScript.git
synced 2026-01-10 14:08:09 -05:00
Simplify actions
This commit is contained in:
16
.github/actions/rust-cache/action.yaml
vendored
16
.github/actions/rust-cache/action.yaml
vendored
@@ -1,16 +0,0 @@
|
|||||||
name: Rust Cache
|
|
||||||
|
|
||||||
runs:
|
|
||||||
using: "composite"
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ~/.cargo
|
|
||||||
key: dot-cargo
|
|
||||||
restore-keys: dot-cargo
|
|
||||||
- uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: target
|
|
||||||
key: target
|
|
||||||
restore-keys: target
|
|
||||||
69
.github/workflows/test-and-deploy.yaml
vendored
Normal file
69
.github/workflows/test-and-deploy.yaml
vendored
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
name: Test and Deploy
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
name: Run cargo test
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/.cargo
|
||||||
|
key: dot-cargo
|
||||||
|
restore-keys: dot-cargo
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: target
|
||||||
|
key: target
|
||||||
|
restore-keys: target
|
||||||
|
|
||||||
|
- name: Install Rust
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
|
||||||
|
- name: Run cargo test
|
||||||
|
run: cargo test
|
||||||
|
|
||||||
|
- name: Install wasm-pack
|
||||||
|
run: |
|
||||||
|
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
||||||
|
|
||||||
|
- name: Configure AWS credentials
|
||||||
|
uses: aws-actions/configure-aws-credentials@v2
|
||||||
|
with:
|
||||||
|
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||||
|
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
|
aws-region: ap-southeast-2
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
cd website
|
||||||
|
npm install
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
cd website
|
||||||
|
./build.sh
|
||||||
|
|
||||||
|
- name: Upload to S3
|
||||||
|
uses: jakejarvis/s3-sync-action@7ed8b112447abb09f1da74f3466e4194fc7a6311
|
||||||
|
with:
|
||||||
|
args: --acl public-read --follow-symlinks --delete
|
||||||
|
env:
|
||||||
|
AWS_S3_BUCKET: valuescript.org
|
||||||
|
AWS_REGION: ap-southeast-2
|
||||||
|
SOURCE_DIR: website/dist
|
||||||
|
|
||||||
|
- name: Invalidate CloudFront distribution
|
||||||
|
run: |
|
||||||
|
aws cloudfront create-invalidation --distribution-id E1X5AVTI60MZKN --paths "/*"
|
||||||
|
env:
|
||||||
|
AWS_REGION: ap-southeast-2
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
name: Cargo Test
|
name: Test
|
||||||
|
|
||||||
on: [push, pull_request]
|
on: [pull_request]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
@@ -10,7 +10,15 @@ jobs:
|
|||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- uses: ./.github/actions/rust-cache
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ~/.cargo
|
||||||
|
restore-keys: pr-dot-cargo
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: target
|
||||||
|
key: pr-target
|
||||||
|
restore-keys: pr-target
|
||||||
|
|
||||||
- name: Install Rust
|
- name: Install Rust
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
57
.github/workflows/website-deploy.yaml
vendored
57
.github/workflows/website-deploy.yaml
vendored
@@ -1,57 +0,0 @@
|
|||||||
name: Build and Deploy Website
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-and-deploy:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- uses: ./.github/actions/rust-cache
|
|
||||||
|
|
||||||
- name: Install Rust
|
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
override: true
|
|
||||||
|
|
||||||
- name: Install wasm-pack
|
|
||||||
run: |
|
|
||||||
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
|
||||||
|
|
||||||
- name: Configure AWS credentials
|
|
||||||
uses: aws-actions/configure-aws-credentials@v2
|
|
||||||
with:
|
|
||||||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
||||||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
||||||
aws-region: ap-southeast-2
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
cd website
|
|
||||||
npm install
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: |
|
|
||||||
cd website
|
|
||||||
./build.sh
|
|
||||||
|
|
||||||
- name: Upload to S3
|
|
||||||
uses: jakejarvis/s3-sync-action@7ed8b112447abb09f1da74f3466e4194fc7a6311
|
|
||||||
with:
|
|
||||||
args: --acl public-read --follow-symlinks --delete
|
|
||||||
env:
|
|
||||||
AWS_S3_BUCKET: valuescript.org
|
|
||||||
AWS_REGION: ap-southeast-2
|
|
||||||
SOURCE_DIR: website/dist
|
|
||||||
|
|
||||||
- name: Invalidate CloudFront distribution
|
|
||||||
run: |
|
|
||||||
aws cloudfront create-invalidation --distribution-id E1X5AVTI60MZKN --paths "/*"
|
|
||||||
env:
|
|
||||||
AWS_REGION: ap-southeast-2
|
|
||||||
Reference in New Issue
Block a user