This commit is contained in:
parent
7a651ec125
commit
689722139c
@ -20,71 +20,36 @@ env:
|
||||
AUTHORITY: "vaasl"
|
||||
|
||||
jobs:
|
||||
check-latest:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
latest_tag: ${{ steps.check-latest.outputs.latest_tag }}
|
||||
run_workflow: ${{ steps.check-latest.outputs.run_workflow }}
|
||||
steps:
|
||||
- name: Get latest release
|
||||
id: check-latest
|
||||
- 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)
|
||||
|
||||
echo "$latest_tag" > tag.txt
|
||||
|
||||
|
||||
echo "::set-output name=latest_tag::$latest_tag"
|
||||
|
||||
current_time=$(date -u +%s)
|
||||
release_time=$(date -u -d "$published_at" +%s)
|
||||
time_diff=$((current_time - release_time))
|
||||
|
||||
if [ $time_diff -le 300 ]; then
|
||||
echo "::set-output name=run_workflow::true"
|
||||
else
|
||||
echo "::set-output name=run_workflow::false"
|
||||
fi
|
||||
|
||||
echo "Latest tag: $latest_tag"
|
||||
echo "Published at: $published_at"
|
||||
echo "Time diff: $time_diff"
|
||||
|
||||
- name: Upload tag file
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: tag-info
|
||||
path: tag.txt
|
||||
|
||||
main_workflow:
|
||||
needs: check-latest
|
||||
# if: needs.check-latest.outputs.run_workflow == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Download tag file
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: tag-info
|
||||
|
||||
- name: Set tag variable
|
||||
run: |
|
||||
RELEASE_TAG=$(cat tag.txt)
|
||||
echo "New release detected: $RELEASE_TAG"
|
||||
- name: "Clone project repository"
|
||||
uses: actions/checkout@v3
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
- name: "Enable Yarn"
|
||||
run: corepack enable
|
||||
- name: "Install registry CLI"
|
||||
run: |
|
||||
npm config set @cerc-io:registry https://git.vdb.to/api/packages/cerc-io/npm/
|
||||
npm install -g @cerc-io/laconic-registry-cli
|
||||
#- name: "Install jq"
|
||||
# run: sudo apt -y update && sudo apt -y install jq
|
||||
- name: "Deploy Namada"
|
||||
run: ./deploy.sh ${{ env.TARGET_REPO }} $RELEASE_TAG
|
||||
|
||||
# Only proceed if release is recent
|
||||
if [ $time_diff -le 300 ]; 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