1
+ name : Dry run release
2
+
3
+ on :
4
+ workflow_dispatch : # Trigger on demand
5
+ schedule : # Trigger weekly all Wednesdays at midnight UTC
6
+ # Trigger weekly on Wednesday at midnight Austin time (Standard Time)
7
+ - cron : " 0 6 * * 3"
8
+
9
+ jobs :
10
+
11
+ dry-run-attach-artifact-to-release :
12
+ uses : liquibase/build-logic/.github/workflows/extension-attach-artifact-release.yml@main
13
+ secrets : inherit
14
+ with :
15
+ dry_run : true
16
+ dry_run_version : " 0.0.${{ github.run_number }}"
17
+
18
+ dry-run-get-draft-release :
19
+ needs : dry-run-attach-artifact-to-release
20
+ runs-on : ubuntu-latest
21
+ outputs :
22
+ dry_run_release_id : ${{ steps.get_draft_release_id.outputs.release_id }}
23
+ steps :
24
+ - name : Get Draft Release ID
25
+ id : get_draft_release_id
26
+ run : |
27
+ release_name="v0.0.${{ github.run_number }}"
28
+ response=$(curl -s -H "Authorization: token ${{ secrets.BOT_TOKEN }}" \
29
+ -H "Accept: application/vnd.github.v3+json" \
30
+ "https://api.github.com/repos/${{ github.repository }}/releases")
31
+ draft_release=$(echo "$response" | jq -r --arg name "$release_name" '.[] | select(.name == $name and .draft == true)')
32
+ if [ -z "$draft_release" ]; then
33
+ echo "No draft release found with the name '$release_name'"
34
+ exit 1
35
+ else
36
+ echo "$draft_release" | jq .
37
+ release_id=$(echo "$draft_release" | jq -r '.id')
38
+ echo "release_id=$release_id" >> $GITHUB_OUTPUT
39
+ fi
40
+
41
+ dry-run-release-published :
42
+ needs : dry-run-get-draft-release
43
+ uses : liquibase/build-logic/.github/workflows/extension-release-published.yml@main
44
+ secrets : inherit
45
+ with :
46
+ dry_run : true
47
+ dry_run_version : " 0.0.${{ github.run_number }}"
48
+ dry_run_release_id : ${{ needs.dry-run-get-draft-release.outputs.dry_run_release_id }}
49
+ deployToMavenCentral : false
50
+
51
+ cleanup :
52
+ runs-on : ubuntu-latest
53
+ if : always()
54
+ needs : [ dry-run-get-draft-release, dry-run-release-published ]
55
+ steps :
56
+ - name : Checkout liquibase
57
+ uses : actions/checkout@v4
58
+
59
+ - name : Set up Git
60
+ run : |
61
+ git config user.name "liquibot"
62
+ git config user.email "[email protected] "
63
+
64
+ - name : Delete liquibase dry-run tag
65
+ if : always()
66
+ run : |
67
+ git push origin --delete refs/tags/v0.0.${{ github.run_number }}
68
+ echo "Remote tag v0.0.${{ github.run_number }} deleted"
69
+
70
+ - name : Delete the dry-run draft release
71
+ if : always()
72
+ run : |
73
+ curl -X DELETE -H "Authorization: token ${{ secrets.BOT_TOKEN }}" \
74
+ -H "Accept: application/vnd.github.v3+json" \
75
+ "https://api.github.com/repos/${{ github.repository }}/releases/${{ needs.dry-run-get-draft-release.outputs.dry_run_release_id }}"
76
+
77
+ notify :
78
+ if : failure()
79
+ runs-on : ubuntu-latest
80
+ needs : [ dry-run-attach-artifact-to-release, dry-run-get-draft-release, dry-run-release-published, cleanup ]
81
+ steps :
82
+ - name : Notify Slack on Build Failure
83
+ uses : rtCamp/action-slack-notify@v2
84
+ env :
85
+ SLACK_COLOR : failure
86
+ SLACK_MESSAGE : " View details on GitHub Actions: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} <@U040C8J8143> <@U04P39MS2SW> <@UHHJ6UAEQ> <@U042HRTL4DT>" # Jandro, Sailee, Jake, Filipe
87
+ SLACK_TITLE : " ❌ ${{ github.repository }} ❌ Build failed on branch ${{ github.ref }} for commit ${{ github.sha }} in repository ${{github.repository}}"
88
+ SLACK_USERNAME : liquibot
89
+ SLACK_WEBHOOK : ${{ secrets.DRY_RUN_RELEASE_SLACK_WEBHOOK }}
90
+ SLACK_ICON_EMOJI : " :robot_face:"
91
+ SLACK_FOOTER : " ${{ github.repository }}"
92
+ SLACK_LINK_NAMES : true
0 commit comments