Add .gitea/workflows/deploy-skip.yml
All checks were successful
Check Latest Release / deploy (push) Successful in 7s
All checks were successful
Check Latest Release / deploy (push) Successful in 7s
This commit is contained in:
parent
d0e3cff793
commit
d1726e61cb
63
.gitea/workflows/deploy-skip.yml
Normal file
63
.gitea/workflows/deploy-skip.yml
Normal file
@ -0,0 +1,63 @@
|
||||
name: Check Latest Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: '*'
|
||||
schedule:
|
||||
- cron: '*/10 * * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
TARGET_REPO: LaconicNetwork/skip-go-app
|
||||
CERC_REGISTRY_USER_KEY: ${{ secrets.CICD_LACONIC_USER_KEY }}
|
||||
CERC_REGISTRY_BOND_ID: ${{ secrets.CICD_LACONIC_BOND_ID }}
|
||||
CERC_REGISTRY_RPC_ENDPOINT: "https://laconicd-sapo.laconic.com"
|
||||
CERC_REGISTRY_GQL_ENDPOINT: "https://laconicd-sapo.laconic.com/api"
|
||||
CERC_REGISTRY_CHAIN_ID: "laconic-testnet-2"
|
||||
CERC_REGISTRY_DEPLOYMENT_HOSTNAME: skip-go-build
|
||||
APP_NAME: "skip-go-build"
|
||||
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: Get latest release and deploy
|
||||
run: |
|
||||
# Get release info
|
||||
latest=$(curl -s https://api.github.com/repos/${{ env.TARGET_REPO }}/releases/latest)
|
||||
latest_tag=$(echo $latest | jq -r .tag_name)
|
||||
published_at=$(echo $latest | jq -r .published_at)
|
||||
|
||||
current_time=$(date -u +%s)
|
||||
release_time=$(date -u -d "$published_at" +%s)
|
||||
time_diff=$((current_time - release_time))
|
||||
|
||||
echo "Latest tag: $latest_tag"
|
||||
echo "Published at: $published_at"
|
||||
echo "Time diff: $time_diff"
|
||||
|
||||
# Only proceed if release is recent
|
||||
if [ $time_diff -le 600 ]; then
|
||||
echo "Recent release detected - 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 }} $latest_tag
|
||||
else
|
||||
echo "No recent release - skipping deployment"
|
||||
fi
|
Loading…
Reference in New Issue
Block a user