Skip to content

Commit

Permalink
merge workflow for automation test
Browse files Browse the repository at this point in the history
  • Loading branch information
WardLordRuby committed Oct 26, 2024
1 parent ac38971 commit c2ee4e9
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/automation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Update download counts

on:
schedule:
- cron: '0 0 * * *' # Runs at 00:00 UTC every day
workflow_dispatch: # Allows manual triggering

jobs:
update-remote-gist:
runs-on: ubuntu-latest
env:
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}

steps:
- name: Restore cached binary
id: cache
continue-on-error: true
uses: actions/cache/restore@v4
with:
path: ./nexus-mods.gz
key: ${{ vars.CACHED_BIN }}

- name: Decompress cached binary
if: steps.cache.outputs.cache-hit
run: |
gunzip -f ./nexus-mods.gz
chmod +x ./nexus-mods
- name: Check for update
id: check_ver
if: steps.cache.outputs.cache-hit
run: |
set +e
./nexus-mods --remote version
echo "exit_code=$?" >> $GITHUB_OUTPUT
- name: Download latest binary
id: download_latest
if: ${{ !steps.cache.outputs.cache-hit || steps.check_ver.outputs.exit_code == '70' }}
continue-on-error: true
run: |
wget "https://drive.google.com/uc?export=download&id=1yHF8B0YynKglsOOsGAb5VXzOCAsCKW5o" -O ./nexus-mods.gz
echo "cache_key_new=${{ runner.os }}-binary-nexus-badges-${{ github.run_id }}-${{ github.run_attempt }}" >> $GITHUB_OUTPUT
- name: Cache latest binary
if: steps.download_latest.outcome == 'success'
uses: actions/cache/save@v4
with:
path: ./nexus-mods.gz
key: ${{ steps.download_latest.outputs.cache_key_new }}

- name: Decompress latest binary
if: steps.download_latest.outcome == 'success'
run: |
gunzip -f ./nexus-mods.gz
chmod +x ./nexus-mods
- name: Remove old cache & update cache key
if: steps.download_latest.outcome == 'success'
continue-on-error: true
env:
REPO_FULL: ${{ github.repository }}
run: ./nexus-mods --remote update-cache-key --old ${{ vars.CACHED_BIN }} --new ${{ steps.download_latest.outputs.cache_key_new }}

- name: Run binary
env:
NEXUS_KEY: ${{ secrets.NEXUS_KEY }}
GIST_ID: ${{ vars.GIST_ID }}
TRACKED_MODS: ${{ vars.TRACKED_MODS }}
run: ./nexus-mods --remote

0 comments on commit c2ee4e9

Please sign in to comment.