diff --git a/.gitea/workflows/deploy-gor.yml b/.gitea/workflows/deploy-gor.yml new file mode 100644 index 0000000..fb4eab4 --- /dev/null +++ b/.gitea/workflows/deploy-gor.yml @@ -0,0 +1,52 @@ +name: Deploy from Main + +on: + push: + branches: '*' + schedule: + - cron: '0 0 * * 0' # Weekly: Every Sunday at midnight UTC + workflow_dispatch: + +env: + TARGET_REPO: gorbagana-dev/gor-website + CERC_REGISTRY_USER_KEY: ${{ secrets.CICD_LACONIC_USER_KEY }} + CERC_REGISTRY_BOND_ID: ${{ secrets.CICD_LACONIC_BOND_ID }} + CERC_REGISTRY_RPC_ENDPOINT: "https://laconicd-mainnet-1.laconic.com" + CERC_REGISTRY_GQL_ENDPOINT: "https://laconicd-mainnet-1.laconic.com/api" + CERC_REGISTRY_CHAIN_ID: "laconic-mainnet" + CERC_REGISTRY_DEPLOYMENT_HOSTNAME: gorbagana + APP_NAME: "gor-website" + DEPLOYER_LRN: "lrn://vaasl-provider/deployers/webapp-deployer-api.apps.vaasl.io" + AUTHORITY: "vaasl" + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: "Clone project repository" + uses: actions/checkout@v3 + + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: Deploy from main branch + run: | + # Get latest commit from main branch + commit_info=$(curl -s https://api.github.com/repos/${{ env.TARGET_REPO }}/commits/main) + commit_hash=$(echo $commit_info | jq -r .sha) + commit_date=$(echo $commit_info | jq -r .commit.committer.date) + + echo "Latest commit: $commit_hash" + echo "Committed at: $commit_date" + echo "Proceeding with deployment" + + # Setup dependencies + sudo apt -y update && sudo apt -y install jq + corepack enable + npm config set @cerc-io:registry https://git.vdb.to/api/packages/cerc-io/npm/ + npm install -g @cerc-io/laconic-registry-cli + + # Run deployment + ./deploy.sh ${{ env.TARGET_REPO }} main \ No newline at end of file