Skip to content
This repository was archived by the owner on Nov 29, 2023. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Create Release

on:
schedule:
- cron: '0 14 * * 1-5'

jobs:
release_needed:
name: Check for Diff Between Main and the Latest Release
runs-on: ubuntu-latest
outputs:
release_needed: ${{ steps.release_needed.outputs.release_needed }}
steps:
- name: Determine if New Release is Needed
id: release_needed
run: |
REL_TIME=$(curl -Ls -H "Accept: application/vnd.github+json" -H "Authorization: token $TOKEN" $GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases/latest | jq -r '.published_at') # Get latest release time
COMMITS=$(curl -Ls -H "Accept: application/vnd.github+json" -H "Authorization: token $TOKEN" $GITHUB_API_URL/repos/$GITHUB_REPOSITORY/commits?since=$REL_TIME | jq '. | length') # Get all commits since last release
if [ $COMMITS '>' 0 ]; then echo "release_needed=true" >> $GITHUB_OUTPUT; else :; fi # If there have been commits to main since the last release, make a new release
env:
TOKEN: ${{ secrets.DX_GITHUB_TOKEN }}

create_release:
name: Create A New Release
runs-on: ubuntu-latest
needs: release_needed
if: ${{needs.release_needed.outputs.release_needed}}
steps:
- name: Make Release
run: |
TAG=$(date +"v%Y.%m.%d") # Format release name/tag using current date
curl -Lfs -X POST -H "Accept: application/vnd.github+json" -H "Authorization: token $TOKEN" $GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases -d '{"tag_name":"'"$TAG"'","name":"'"$TAG"'","generate_release_notes":true}' # Create release
env:
TOKEN: ${{ secrets.DX_GITHUB_TOKEN }}