Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use env for release and refactor to one file #890

Merged
merged 7 commits into from
Jul 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions .github/workflows/deploy-prod-mainnet-devhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@ jobs:
deploy-widgets:
runs-on: ubuntu-latest
name: Deploy ( or diff from PR ) - Devhub
env:
NEAR_SOCIAL_DEPLOY_ID: ${{ vars.NEAR_SOCIAL_ACCOUNT_ID }}
NEAR_SOCIAL_ACCOUNT_ID: ${{ vars.NEAR_SOCIAL_ACCOUNT_ID }}
NEAR_SOCIAL_ACCOUNT_PUBLIC_KEY: ${{ vars.NEAR_SOCIAL_ACCOUNT_PUBLIC_KEY }}
NEAR_SOCIAL_ACCOUNT_PRIVATE_KEY: ${{ secrets.NEAR_SOCIAL_ACCOUNT_PRIVATE_KEY }}
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
environment: devhub.near
defaults:
run:
working-directory: ./instances/devhub.near
Expand All @@ -23,7 +18,7 @@ jobs:
- name: Set replacements
id: set_replacements
run: |
echo "replacements=$(jq -r '[to_entries[] | .["find"] = "${" + .key + "}" | .["replace"] = .value | del(.key, .value), {"find": "${REPL_POSTHOG_API_KEY}", "replace": "'$POSTHOG_API_KEY'"}]' aliases.mainnet.json | tr -d "\n\r")" >> $GITHUB_OUTPUT
echo "replacements=$(jq -r '[to_entries[] | .["find"] = "${" + .key + "}" | .["replace"] = .value | del(.key, .value), {"find": "${REPL_POSTHOG_API_KEY}", "replace": "'${{ secrets.POSTHOG_API_KEY }}'"}]' aliases.mainnet.json | tr -d "\n\r")" >> $GITHUB_OUTPUT

- name: Replace placeholders
uses: flcdrg/replace-multiple-action@v1
Expand All @@ -33,8 +28,9 @@ jobs:
prefix: "(^|.*)"
suffix: "($|.*)"

- name: Install bos CLI
- name: Install dependencies
run: |
npm ci
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/FroVolod/bos-cli-rs/releases/download/v0.3.6/bos-cli-installer.sh | sh

- name: Deploy widgets
Expand All @@ -43,7 +39,7 @@ jobs:
echo "on branch $BRANCH"
if [[ "$BRANCH" != "main" ]]; then
echo "Not on main branch, dry run by diff with devhub.near"
bos components diff devhub.near network-config mainnet
npm run dry-run:devhub
else
bos components deploy "$NEAR_SOCIAL_DEPLOY_ID" sign-as "$NEAR_SOCIAL_ACCOUNT_ID" network-config mainnet sign-with-plaintext-private-key --signer-public-key "$NEAR_SOCIAL_ACCOUNT_PUBLIC_KEY" --signer-private-key "$NEAR_SOCIAL_ACCOUNT_PRIVATE_KEY" send
bos components deploy '${{ vars.NEAR_SOCIAL_ACCOUNT_ID }}' sign-as '${{ vars.NEAR_SOCIAL_ACCOUNT_ID }}' network-config mainnet sign-with-plaintext-private-key --signer-public-key '${{ vars.NEAR_SOCIAL_ACCOUNT_PUBLIC_KEY }}' --signer-private-key '${{ secrets.NEAR_SOCIAL_ACCOUNT_PRIVATE_KEY }}' send
fi
49 changes: 0 additions & 49 deletions .github/workflows/deploy-prod-mainnet-events.yml

This file was deleted.

49 changes: 0 additions & 49 deletions .github/workflows/deploy-prod-mainnet-infra.yml

This file was deleted.

39 changes: 39 additions & 0 deletions .github/workflows/release-instances.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Deploy Components to Mainnet - Events and Infrastructure

on:
pull_request:
push:
branches: [main]

jobs:
deploy-widgets:
name: Deploy (or diff from PR)
runs-on: ubuntu-latest
strategy:
matrix:
target_account:
- environment: events-committee.near
dry_run_command: npm run dry-run:events
deploy_command: npm run deploy:events
- environment: infrastructure-committee.near
dry_run_command: npm run dry-run:infrastructure
deploy_command: npm run deploy:infrastructure
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install dependencies
run: |
npm ci
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/FroVolod/bos-cli-rs/releases/download/v0.3.6/bos-cli-installer.sh | sh

- name: Deploy widgets
run: |
BRANCH=$(git rev-parse --abbrev-ref HEAD)
echo "On branch $BRANCH"
if [[ "$BRANCH" != "main" ]]; then
echo "Not on main branch, dry run"
${{ matrix.target_account.dry_run_command }}
else
${{ matrix.target_account.deploy_command }} -- "${{ vars.NEAR_SOCIAL_ACCOUNT_ID }}" sign-as "${{ vars.NEAR_SOCIAL_ACCOUNT_ID }}" network-config mainnet sign-with-plaintext-private-key "${{ vars.NEAR_SOCIAL_ACCOUNT_PUBLIC_KEY }}" --signer-private-key "${{ secrets.NEAR_SOCIAL_ACCOUNT_PRIVATE_KEY }}" send
fi
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,20 @@
"build": "npm run fmt",
"bw": "bos-workspace",
"bw:dev:devhub": "bw dev instances/devhub.near",
"bw:build:devhub": "bw build instances/devhub.near build/devhub.near && mv build/devhub.near/src/widget/* build/devhub.near/src/ && rm -Rf build/devhub.near/src/widget",
"bw:build:instance": "npm run bw build instances/$npm_config_instance build/$npm_config_instance && mv build/$npm_config_instance/src/widget/* build/$npm_config_instance/src/ && rm -Rf build/$npm_config_instance/src/widget",
"bw:build:devhub": "npm run bw:build:instance --instance=devhub.near",
"gateway:devhub": "node scripts/dev-gateway.mjs devhub.near",
"dry-run:devhub": "npm run bw:build:devhub && cd ./build/devhub.near && bos components diff devhub.near network-config mainnet",
"bw:dev:infrastructure": "bw dev instances/infrastructure-committee.near",
"bw:build:infrastructure": "bw build instances/infrastructure-committee.near",
"bw:build:infrastructure": "npm run bw:build:instance --instance=infrastructure-committee.near",
"gateway:infrastructure": "node scripts/dev-gateway.mjs infrastructure-committee.near",
"deploy:infrastructure": "npm run bw:build:infrastructure && cd ./build/infrastructure-committee.near && bos components deploy",
"dry-run:infrastructure": "npm run bw:build:infrastructure && cd ./build/infrastructure-committee.near && bos components diff infrastructure-committee.near network-config mainnet",
"bw:dev:events": "bw dev instances/events-committee.near",
"bw:build:events": "bw build instances/events-committee.near",
"bw:build:events": "npm run bw:build:instance --instance=events-committee.near",
"gateway:events": "node scripts/dev-gateway.mjs events-committee.near",
"deploy:events": "npm run bw:build:events && cd ./build/events-committee.near && bos components deploy",
"dry-run:events": "npm run bw:build:events && cd ./build/events-committee.near && bos components diff events-committee.near network-config mainnet",
"test": "npx playwright test",
"test:devhub": "INSTANCE=devhub npx playwright test --project=devhub --ui",
"test:events": "INSTANCE=events npx playwright test --project=events --ui",
Expand Down
Loading