distribution/.github/workflows/release-dev.yaml

80 lines
2.4 KiB
YAML
Raw Normal View History

2022-04-10 19:51:34 +00:00
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2021-present 351ELEC
# Copyright (C) 2022-present Fewtarius
### Based on work by @pkegg
name: release-dev
on:
schedule:
- cron: '0 17 * * *'
workflow_dispatch:
env:
BRANCH: dev
2022-04-12 20:42:33 +00:00
REFCOMMIT: commit.txt
2022-04-10 19:51:34 +00:00
jobs:
launch-dev-release:
2022-04-10 19:51:34 +00:00
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
name: checkout
with:
clean: false
fetch-depth: 0
ref: "${{env.BRANCH}}"
- name: only run on the primary repository
if: ${{ !startsWith(github.repository_owner, 'JustEnoughLinuxOS') }}
run: exit 0
2022-04-10 19:51:34 +00:00
- name: repository full name
id: full_name
run: |
echo "::set-output name=full_name::$(git config --get remote.origin.url | sed 's|^.*github.com/||g' | sed 's/.git$//g')"
2022-04-12 20:42:33 +00:00
- name: Get the last commit of the last build from the artifact
uses: actions/download-artifact@v1.0.0
with:
name: LASTCOMMIT
path: ${{ env.REFCOMMIT }}
continue-on-error: true
2022-04-10 19:51:34 +00:00
- name: changes
id: changes
run: |
2022-04-12 20:42:33 +00:00
release_notes="$(git log ${LASTCOMMIT}..HEAD --pretty=format:"* %h: %s")"
2022-04-10 19:51:34 +00:00
echo "::set-output name=changes::$(echo ${release_notes} | wc -l)"
echo "::set-output name=release_notes::${release_notes}"
2022-04-12 20:42:33 +00:00
continue-on-error: true
- name: Store current commit id as an artifact
run: git rev-parse HEAD | tee ${{ env.REFCOMMIT }}
- name: Store current commit artifact
uses: actions/upload-artifact@v1.0.0
with:
name: LASTCOMMIT
path: ${{ env.REFCOMMIT }}
2022-04-10 19:51:34 +00:00
- name: Get date for artifacts
id: date
run: echo "::set-output name=date::$(date +'%Y%m%d%H%M')"
- name: Repository Dispatch
if: steps.changes.outputs.changes != '0'
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.REPO_ACCESS }}
repository: ${{ steps.full_name.outputs.full_name }}
event-type: release-dev
client-payload: |
{
"branch" : "${{ env.BRANCH }}",
"release_tag" : "${{steps.date.outputs.date}}",
"release_notes" : ${{toJSON(steps.changes.outputs.release_notes)}}
}