Skip to content

s3 version for caching #41

s3 version for caching

s3 version for caching #41

Workflow file for this run

name: Release to dev
on:
push:
branches:
- 'dev'
- 'ci/*'
workflow_dispatch:
env:
PROFILE: release
jobs:
build:
runs-on: ubuntu-latest
concurrency: dev
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v3
- name: Cache cargo registry
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::${{ vars.DEV_NETWORK_AWS_ACCOUNT_ID }}:role/github
role-session-name: ${{ github.event.repository.name }}
aws-region: us-west-2
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Get short SHA
run: |
echo GITHUB_SHA=${GITHUB_SHA:0:7} >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push docker image to ECR
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile-new
push: true
build-args: |
"AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID }"
"AWS_SECRET_ACCESS_KEY=${AWS_ACCESS_KEY_ID }"
"AWS_SESSION_TOKEN=${AWS_ACCESS_KEY_ID}"
"SCCACHE_REGION=${AWS_REGION}"
"SCCACHE_BUCKET=cere-blockchain-sccache"
tags: |
${{ steps.login-ecr.outputs.registry }}/pos-network-node:${{ github.sha }}
${{ steps.login-ecr.outputs.registry }}/pos-network-node:dev-latest
# - uses: actions-rs/toolchain@v1
# with:
# toolchain: nightly-2022-10-09
# profile: minimal
# override: true
# components: rustfmt, clippy
#
# - name: Run sccache-cache
# uses: mozilla-actions/[email protected]
#
# - name: Cache cargo registry
# uses: actions/cache@v3
# continue-on-error: false
# with:
# path: |
# ~/.cargo/registry
# ~/.cargo/git
# key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
# restore-keys: |
# ${{ runner.os }}-cargo-
#
# - name: Save sccache
# uses: actions/cache@v2
# continue-on-error: false
# with:
# path: ${{ env.SCCACHE_DIR }}
# key: ${{ runner.os }}-sccache-${{ hashFiles('**/Cargo.lock') }}
# restore-keys: |
# ${{ runner.os }}-sccache-
#
# - name: Lint
# run: cargo fmt --all -- --check
#
# - name: Install Protoc
# uses: arduino/setup-protoc@v1
# with:
# version: "3.15.8"
#
# - name: Start sccache server
# run: sccache --start-server
#
# - name: Build
# run: cargo build --release
#
# - name: Stop sccache server
# run: sccache --stop-server || true
#
# - name: configure aws credentials
# uses: aws-actions/configure-aws-credentials@v2
# with:
# role-to-assume: arn:aws:iam::${{ vars.DEV_NETWORK_AWS_ACCOUNT_ID }}:role/github
# role-session-name: ${{ github.event.repository.name }}
# aws-region: us-west-2
#
# - name: Get short SHA
# run: |
# echo GITHUB_SHA=${GITHUB_SHA:0:7} >> $GITHUB_ENV
#
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v2
# - name: Login to Amazon ECR
# id: login-ecr
# uses: aws-actions/amazon-ecr-login@v1
# - name: Build and push docker image to ECR
# uses: docker/build-push-action@v4
# with:
# context: .
# file: ./Dockerfile-new
# push: true
# tags: |
# ${{ steps.login-ecr.outputs.registry }}/pos-network-node:${{ github.sha }}
# ${{ steps.login-ecr.outputs.registry }}/pos-network-node:dev-latest
#
# - name: Upload cere-runtime wasm artifact
# uses: actions/upload-artifact@v3
# with:
# name: cere_runtime.compact.compressed.${{ env.GITHUB_SHA }}.wasm
# path: target/${{ vars.PROFILE }}/wbuild/cere-runtime/cere_runtime.compact.compressed.wasm
#
# - name: Upload cere-dev-runtime wasm artifact
# uses: actions/upload-artifact@v3
# with:
# name: cere_dev_runtime.compact.compressed.${{ env.GITHUB_SHA }}.wasm
# path: target/${{ vars.PROFILE }}/wbuild/cere-dev-runtime/cere_dev_runtime.compact.compressed.wasm