Skip to content

Commit

Permalink
auto nightly releases
Browse files Browse the repository at this point in the history
  • Loading branch information
cocoa-xu committed May 8, 2024
1 parent bfaf5f0 commit 979a85c
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/nightly-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: auto-nightly-release

on:
workflow_dispatch:
schedule:
- cron: "0 4 * * *"

jobs:
auto-update:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.AUTO_UPDATE_TOKEN }}

- name: Get latest version
id: mock-version
run: |
git clone --branch feat-mocks --depth 1 https://github.com/meowcraft-dev/arrow-adbc.git
cd arrow-adbc
LATEST_COMMIT_DATE=$(git log -1 --date=format:"%Y%m%d" --format="%ad")
CURRENT_DATE=$(date +"%Y%m%d")
echo "Latest commit date is $LATEST_COMMIT_DATE"
echo "Current date is $CURRENT_DATE"
if [ "$LATEST_COMMIT_DATE" == "$CURRENT_DATE" ]; then
echo "will update nightly-$LATEST_COMMIT_DATE"
echo "tag=nightly-${LATEST_COMMIT_DATE}" >> $GITHUB_OUTPUT
echo "has_updates=true" >> $GITHUB_OUTPUT
else
echo "has_updates=false" >> $GITHUB_OUTPUT
fi
- name: Check if has updates and if already tagged
if: steps.mock-version.outputs.has_updates == 'true'
uses: mukunku/[email protected]
id: check-tag
with:
tag: ${{ steps.mock-version.outputs.tag }}
repo: 'meowcraft-dev/adbc_driver_mocks'

- name: Update if tag not exists
if: steps.mock-version.outputs.has_updates == 'true' && steps.check-tag.outputs.exists == 'false'
run: |
git config user.name github-actions
git config user.email [email protected]
git tag ${{ steps.mock-version.outputs.tag }}
git push origin ${{ steps.mock-version.outputs.tag }}
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
tags:
- 'v*'
- 'nightly-*'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down

0 comments on commit 979a85c

Please sign in to comment.