Skip to content

Merge pull request #285 from NethermindEth/bohdan/refactor #97

Merge pull request #285 from NethermindEth/bohdan/refactor

Merge pull request #285 from NethermindEth/bohdan/refactor #97

Workflow file for this run

name: (develop) Auto React package build & deploy
on:
push:
branches:
- develop
paths:
- 'plugin/**'
env:
NODE_VERSION: '20.x'
BUCKET_NAME: 'starknet-remix-plugin-web'
PROD_BUCKET_NAME: 'starknet-remix-plugin-prod-web'
API_SERVICE_URL: "https://cairo-remix-api-dev.nethermind.io"
STARKNET_DEVNET_URL: "https://starknet-remix-devnet.nethermind.io"
permissions:
id-token: write
contents: read
jobs:
Build:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Determine version numbers
id: determine-version
uses: paulhatch/[email protected]
with:
# The prefix to use to identify tags
tag_prefix: "v"
# A string which, if present in a git commit, indicates that a change represents a
# major (breaking) change, supports regular expressions wrapped with '/'
major_pattern: "(MAJOR)"
# A string which indicates the flags used by the `major_pattern` regular expression. Supported flags: idgs
major_regexp_flags: ""
# Same as above except indicating a minor change, supports regular expressions wrapped with '/'
minor_pattern: "(MINOR)"
# A string which indicates the flags used by the `minor_pattern` regular expression. Supported flags: idgs
minor_regexp_flags: ""
# A string to determine the format of the version output
version_format: "${major}.${minor}.${patch}-dev${increment}"
# If this is set to true, *every* commit will be treated as a new version.
bump_each_commit: false
# If bump_each_commit is also set to true, setting this value will cause the version to increment only if the pattern specified is matched.
bump_each_commit_patch_pattern: ""
# If true, the body of commits will also be searched for major/minor patterns to determine the version type.
search_commit_body: false
# The output method used to generate list of users, 'csv' or 'json'.
user_format_type: "csv"
# Prevents pre-v1.0.0 version from automatically incrementing the major version.
# If enabled, when the major version is 0, major releases will be treated as minor and minor as patch. Note that the version_type output is unchanged.
enable_prerelease_mode: true
# If enabled, diagnostic information will be added to the action output.
debug: false
- name: Inject version
env:
SED_COMMAND: 's/\"version\"\:[ ]\"0.1.0\"/\"version\": \"0.3.0\"/g'
run: |
sed -i 's/\"version\"\:[ ]\"[0-9].[0-9]*.[0-9]*\"/\"version\": \"${{ steps.determine-version.outputs.version }}\"/g' ./plugin/package.json
- name: Setup Node ${{ env.NODE_VERSION }} Environment
uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install dependencies
run: npm install -g pnpm
- name: pnpm install
working-directory: ./plugin
run: pnpm install
- name: pnpm build
working-directory: ./plugin
run: pnpm run build
- name: 'Upload Artifact'
uses: actions/upload-artifact@v3
with:
name: react-github-actions-build
path: ./plugin/build/**/*
Deploy:
if: github.ref == 'refs/heads/develop'
runs-on: ubuntu-latest
needs: Build
steps:
- name: Get artifact
uses: actions/download-artifact@v3
with:
name: react-github-actions-build
path: artifact
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: us-east-2
role-to-assume: arn:aws:iam::599564732950:role/Aws-GH-Action-Assume-Role-Starknet
role-session-name: GHStarknet
- name: Deploy to S3
run: aws s3 sync . s3://${{ env.BUCKET_NAME }} --acl public-read
working-directory: artifact
Deploy_Prod:
if: github.ref == 'refs/heads/starknet-production-setup'
runs-on: ubuntu-latest
needs: Build
steps:
- name: Get artifact
uses: actions/download-artifact@v3
with:
name: react-github-actions-build
path: artifact
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: us-east-2
role-to-assume: arn:aws:iam::228016254426:role/Aws-GH-Action-Assume-Role-Starknet-Production
role-session-name: GHStarknet
- name: Deploy to S3
run: aws s3 sync . s3://${{ env.PROD_BUCKET_NAME }} --acl public-read
working-directory: artifact