-
Notifications
You must be signed in to change notification settings - Fork 1
81 lines (73 loc) · 2.72 KB
/
auto_release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# This workflow will run whenever tests finish running. If tests pass, it will
# look at the last commit message to see if it contains the phrase
# "chore(deps): update all dependencies".
#
# If it finds a commit with that phrase, and the testing workflow has passed,
# it will automatically release a new version of the project by running the
# publish workflow.
#
# The commit message phrase above is always used by renovatebot when opening
# PR's to update dependencies. If you have renovatebot enabled and set to
# automatically merge in dependency updates, this can automatically release and
# publish the updated version of the project.
#
# You can disable this action by setting the DISABLE_AUTO_RELEASE repository
# variable to true.
name: "🦾 Auto-Release"
on:
workflow_run:
workflows: ["🚥 Tests"]
branches:
- main
types:
- completed
jobs:
auto_release:
name: 🦾 Auto-Release
runs-on: ubuntu-latest
outputs:
should_release: ${{ steps.release.outputs.should_release }}
steps:
- name: 🧾 Checkout
uses: actions/checkout@v4
with:
# Use your GitHub Personal Access Token variable here.
token: ${{ secrets.GH_BASIC }}
lfs: true
submodules: "recursive"
- name: 🧑🔬 Check Test Results
id: tests
run: |
echo "passed=${{ github.event.workflow_run.conclusion == 'success' }}" >> "$GITHUB_OUTPUT"
- name: 📄 Check If Dependencies Changed
id: deps
run: |
message=$(git log -1 --pretty=%B)
if [[ $message == *"chore(deps)"* ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
else
echo "changed=false" >> "$GITHUB_OUTPUT"
fi
- name: 📝 Check Release Status
id: release
run: |
echo "Tests passed: ${{ steps.tests.outputs.passed }}"
echo "Dependencies changed: ${{ steps.deps.outputs.changed }}"
disable_auto_release='${{ vars.DISABLE_AUTO_RELEASE }}'
echo "DISABLE_AUTO_RELEASE=$disable_auto_release"
if [[ ${{ steps.tests.outputs.passed }} == "true" && ${{ steps.deps.outputs.changed }} == "true" && $disable_auto_release != "true" ]]; then
echo "should_release=true" >> "$GITHUB_OUTPUT"
echo "🦾 Creating a release!"
else
echo "should_release=false" >> "$GITHUB_OUTPUT"
echo "✋ Not creating a release."
fi
trigger_release:
uses: "./.github/workflows/release.yaml"
needs: auto_release
if: needs.auto_release.outputs.should_release == 'true'
secrets:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
GH_BASIC: ${{ secrets.GH_BASIC }}
with:
bump: patch