Skip to content

release-dev

release-dev #332

Workflow file for this run

# The purpose of this build is to allow a 'dev' release be created.
# dev releases are unsupported and should only be used by developers or at the request of a developer
# Typically, it will be created every day if there are new commits since the last tag
# It can also be run manually.
name: release-dev
on:
schedule:
- cron: '0 5 * * *' # Have ready for beginning of day in Europe where most devs are.
workflow_dispatch: # allows manual runs
env:
BRANCH: dev
jobs:
launch-dev-release-if-needed:
runs-on: ubuntu-20.04
steps:
#- uses: hmarr/debug-action@v2
# name: debug
- uses: actions/checkout@v4
name: checkout
with:
clean: false
fetch-depth: 0
ref: "${{env.BRANCH}}"
# We get the full name from git here as in the case of 'cron', it is not available on the event
- name: repository full name
id: dev_builds_full_name
run: |
echo "full_name=351dev/dev-builds" >> $GITHUB_OUTPUT
- name: repository full name
id: full_name
run: |
echo "full_name=$(git config --get remote.origin.url | sed 's|^.*github.com/||g' | sed 's/.git$//g')" >> $GITHUB_OUTPUT
- name: changes
id: changes
run: |
#Figure out last dev build date by converting the latest 351dev/dev-builds tag into a date and
# looking for commits in AmberELEC newer than that date
git clone https://github.com/${{ steps.dev_builds_full_name.outputs.full_name }} dev
pushd dev
last_tag=$(git tag -l | grep "dev-" | tail -1)
last_dev_formatted=$(echo ${last_tag} | sed 's/dev-//g ; s/_/ /g')
last_dev_date=$(date -d"${last_dev_formatted}")
echo "last dev date: ${last_dev_date}"
popd
echo changes=$(git log --after=" >> $GITHUB_OUTPUT${last_dev_date}" --oneline | wc -l)
release_notes="$(git log --after=\\"${last_dev_date}\\" --oneline | sed 's|^|${{ steps.full_name.outputs.full_name }}@|g')"
# The below lines translate linebreaks so they can be set into the 'release_notes' variable
release_notes="${release_notes//'%'/'%25'}"
release_notes="${release_notes//$'\n'/'<br />'}"
release_notes="${release_notes//$'\r'/'%0D'}"
echo "release_notes=${release_notes}" >> $GITHUB_OUTPUT
- name: Get date for artifacts
id: date
run: echo "date=$(date +'%Y%m%d_%H%M')" >> $GITHUB_OUTPUT
- name: Repository Dispatch
if: ${{ steps.changes.outputs.changes }} != '0'
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.TRIGGER_BUILD_TOKEN }}
repository: ${{ steps.full_name.outputs.full_name }}
event-type: release-dev
client-payload: |
{
"branch" : "${{ env.BRANCH }}",
"release_tag" : "dev-${{steps.date.outputs.date}}",
"release_notes" : ${{toJSON(steps.changes.outputs.release_notes)}}
}