-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adds workflow to deploy to testnet (#305)
* feat: adds workflow to deploy to testnet * fix: prettier * fix: build script * feature: devhub.testnet workflow * feat: creates dev script * feat: replaces release workflow * feat: adds weekly promotion of develop to main
- Loading branch information
1 parent
00dac74
commit e0dc11d
Showing
11 changed files
with
273 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Deploy Widgets to Testnet Dev | ||
on: | ||
push: | ||
branches: [develop] | ||
jobs: | ||
deploy-widgets: | ||
runs-on: ubuntu-latest | ||
name: Deploy widgets to devhub-dev.testnet | ||
env: | ||
NEAR_SOCIAL_ACCOUNT_ID: ${{ vars.NEAR_SOCIAL_TESTNET_DEV_ACCOUNT_ID }} | ||
NEAR_SOCIAL_ACCOUNT_PUBLIC_KEY: ${{ vars.NEAR_SOCIAL_TESTNET_DEV_ACCOUNT_PUBLIC_KEY }} | ||
NEAR_SOCIAL_ACCOUNT_PRIVATE_KEY: ${{ secrets.NEAR_SOCIAL_TESTNET_DEV_ACCOUNT_PRIVATE_KEY }} | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set replacements | ||
id: set_replacements | ||
run: | | ||
echo "replacements=$(jq -r '[to_entries[] | .["find"] = "${" + .key + "}" | .["replace"] = .value | del(.key, .value)]' replacements.dev.json | tr -d "\n\r")" >> $GITHUB_OUTPUT | ||
- name: Replace placeholders | ||
uses: flcdrg/replace-multiple-action@v1 | ||
with: | ||
files: '**/*.jsx' | ||
find: '${{ steps.set_replacements.outputs.replacements }}' | ||
prefix: '(^|.*)' | ||
suffix: '($|.*)' | ||
|
||
- name: Install bos CLI | ||
run: | | ||
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/FroVolod/bos-cli-rs/releases/download/v0.3.5/bos-cli-v0.3.1-installer.sh | sh | ||
- name: Deploy widgets | ||
run: | | ||
which bos | ||
echo $PATH | ||
bos components deploy "$NEAR_SOCIAL_ACCOUNT_ID" sign-as "$NEAR_SOCIAL_ACCOUNT_ID" network-config testnet sign-with-plaintext-private-key --signer-public-key "$NEAR_SOCIAL_ACCOUNT_PUBLIC_KEY" --signer-private-key "$NEAR_SOCIAL_ACCOUNT_PRIVATE_KEY" send |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Deploy Widgets to Mainnet | ||
on: | ||
push: | ||
branches: [main] | ||
jobs: | ||
deploy-widgets: | ||
runs-on: ubuntu-latest | ||
name: Deploy widgets to social.near (mainnet) | ||
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 }} | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set replacements | ||
id: set_replacements | ||
run: | | ||
echo "replacements=$(jq -r '[to_entries[] | .["find"] = "${" + .key + "}" | .["replace"] = .value | del(.key, .value)]' replacements.mainnet.json | tr -d "\n\r")" >> $GITHUB_OUTPUT | ||
- name: Replace placeholders | ||
uses: flcdrg/replace-multiple-action@v1 | ||
with: | ||
files: '**/*.jsx' | ||
find: '${{ steps.set_replacements.outputs.replacements }}' | ||
prefix: '(^|.*)' | ||
suffix: '($|.*)' | ||
|
||
- name: Install bos CLI | ||
run: | | ||
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/FroVolod/bos-cli-rs/releases/download/v0.3.2/bos-cli-installer.sh | sh | ||
- name: Deploy widgets | ||
run: | | ||
which bos | ||
echo $PATH | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Deploy Widgets to Testnet | ||
on: | ||
push: | ||
branches: [main] | ||
jobs: | ||
deploy-widgets: | ||
runs-on: ubuntu-latest | ||
name: Deploy widgets to devhub.testnet | ||
env: | ||
NEAR_SOCIAL_ACCOUNT_ID: ${{ vars.NEAR_SOCIAL_TESTNET_ACCOUNT_ID }} | ||
NEAR_SOCIAL_ACCOUNT_PUBLIC_KEY: ${{ vars.NEAR_SOCIAL_TESTNET_ACCOUNT_PUBLIC_KEY }} | ||
NEAR_SOCIAL_ACCOUNT_PRIVATE_KEY: ${{ secrets.NEAR_SOCIAL_TESTNET_ACCOUNT_PRIVATE_KEY }} | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set replacements | ||
id: set_replacements | ||
run: | | ||
echo "replacements=$(jq -r '[to_entries[] | .["find"] = "${" + .key + "}" | .["replace"] = .value | del(.key, .value)]' replacements.testnet.json | tr -d "\n\r")" >> $GITHUB_OUTPUT | ||
- name: Replace placeholders | ||
uses: flcdrg/replace-multiple-action@v1 | ||
with: | ||
files: '**/*.jsx' | ||
find: '${{ steps.set_replacements.outputs.replacements }}' | ||
prefix: '(^|.*)' | ||
suffix: '($|.*)' | ||
|
||
- name: Install bos CLI | ||
run: | | ||
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/FroVolod/bos-cli-rs/releases/download/v0.3.5/bos-cli-installer.sh | sh | ||
- name: Deploy widgets | ||
run: | | ||
which bos | ||
echo $PATH | ||
bos components deploy "$NEAR_SOCIAL_ACCOUNT_ID" sign-as "$NEAR_SOCIAL_ACCOUNT_ID" network-config testnet sign-with-plaintext-private-key --signer-public-key "$NEAR_SOCIAL_ACCOUNT_PUBLIC_KEY" --signer-private-key "$NEAR_SOCIAL_ACCOUNT_PRIVATE_KEY" send |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: weekly-production-release | ||
|
||
on: | ||
schedule: | ||
- cron: '0 0 * * THU' | ||
|
||
permissions: | ||
pull-requests: write | ||
|
||
jobs: | ||
pull-request: | ||
runs-on: ubuntu-latest | ||
if: github.ref == 'refs/heads/develop' | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: pull-request | ||
run: | | ||
gh pr create --base main --head develop -f -a ailisp -a frol --title "weekly promotion of develop to main" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
node_modules | ||
.vscode | ||
.DS_Store | ||
|
||
// replacements | ||
replacements.*.json.tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"REPL_DEVHUB": "devhub-dev.testnet", | ||
"REPL_DEVHUB_CONTRACT": "thomaspreview.testnet", | ||
"REPL_NEAR": "discom.testnet", | ||
"REPL_MOB": "eugenethedream", | ||
"REPL_EFIZ": "efiz.testnet" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"REPL_DEVHUB": "devhub.testnet", | ||
"REPL_DEVHUB_CONTRACT": "thomaspreview.testnet", | ||
"REPL_NEAR": "discom.testnet", | ||
"REPL_MOB": "eugenethedream", | ||
"REPL_EFIZ": "efiz.testnet" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/bin/bash | ||
|
||
# Check if bos-loader is installed | ||
if ! command -v bos-loader &> /dev/null; then | ||
# Install bos-loader | ||
echo "bos-loader is not installed. Installing..." | ||
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/mpeterdev/bos-loader/releases/download/v0.7.1/bos-loader-v0.7.1-installer.sh | sh | ||
fi | ||
|
||
# Define default values | ||
ACCOUNT_ID="devhub.testnet" | ||
CONTRACT_ID="devhub.testnet" | ||
NETWORK_ENV="testnet" | ||
CREATOR_REPL="REPL_DEVHUB" | ||
CONTRACT_REPL="REPL_DEVHUB_CONTRACT" | ||
|
||
# Parse command line arguments | ||
while [[ $# -gt 0 ]]; do | ||
key="$1" | ||
case $key in | ||
-a|--account) | ||
ACCOUNT_ID="$2" | ||
shift | ||
shift | ||
;; | ||
-c|--contract) | ||
CONTRACT_ID="$2" | ||
shift | ||
shift | ||
;; | ||
-n|--network) | ||
NETWORK_ENV="$2" | ||
shift | ||
shift | ||
;; | ||
*) | ||
echo "Unknown option: $1" | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
# Convert NETWORK_ENV to lowercase | ||
NETWORK_ENV=$(echo "$NETWORK_ENV" | tr '[:upper:]' '[:lower:]') | ||
|
||
echo "NETWORK_ENV: $NETWORK_ENV" | ||
|
||
# Update the value in replacements.json | ||
REPLACEMENTS_JSON="replacements.$NETWORK_ENV.json" | ||
|
||
if [ -f "$REPLACEMENTS_JSON" ]; then | ||
# Replace the value in the JSON file | ||
|
||
jq --arg ACCOUNT_ID "$ACCOUNT_ID" --arg CONTRACT_ID "$CONTRACT_ID" ".[\"$CREATOR_REPL\"] = \"$ACCOUNT_ID\" | .[\"$CONTRACT_REPL\"] = \"$CONTRACT_ID\"" "$REPLACEMENTS_JSON" > "$REPLACEMENTS_JSON.tmp" | ||
else | ||
echo "Error: $REPLACEMENTS_JSON file not found." | ||
exit 1 | ||
fi | ||
|
||
# Run bos-loader with updated replacements | ||
bos-loader "$ACCOUNT_ID" --path src -r "$REPLACEMENTS_JSON" |