Skip to content

Commit 15b4817

Browse files
committed
Automagically make a new release if the daily build has succeeded
Fixes #326
1 parent dad1d60 commit 15b4817

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

.github/workflows/release.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Release
2+
3+
on:
4+
schedule:
5+
- cron: '0 3 * * 1'
6+
workflow_dispatch:
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
name: Release
12+
steps:
13+
- uses: actions/checkout@v4
14+
- run: git config user.email '[email protected]' && git config user.name 'Jakub Zalas'
15+
- run: sudo apt-get update && sudo apt-get install -y hub
16+
- run: make release
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}

Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,21 @@ release:
6969
hub release create -m '$(LATEST_RELEASE)' -m '' -m ':robot: Automagically created release.' v$(LATEST_RELEASE)
7070
.PHONY: release
7171

72+
auto-release:
73+
@curl -s 'https://api.github.com/repos/jakzal/phpqa/actions/runs?branch=master' | \
74+
jq '[.workflow_runs[] | select(.name == "Build") | {id, name, conclusion, html_url, created_at, updated_at} ] | first' | \
75+
jq -r '.conclusion' | \
76+
grep -q success && \
77+
( \
78+
echo "The last build has succeeded. Making the release." && \
79+
$(shell $(MAKE) release) \
80+
) || \
81+
( \
82+
echo "The last build has failed. Skipping the release." && \
83+
exit 1 \
84+
)
85+
.PHONY: auto-release
86+
7287
update-readme-release: LATEST_RELEASE ?= 0.0.0
7388
update-readme-release:
7489
$(eval LATEST_RELEASE_MINOR=$(shell echo $(LATEST_RELEASE) | cut -f1,2 -d.))

0 commit comments

Comments
 (0)