1
+ name : Crates and GitHub release
2
+
3
+ on :
4
+ workflow_dispatch :
5
+ inputs :
6
+ ezno-version :
7
+ description : " major/minor/patch or semver"
8
+ required : false
9
+ default : " none"
10
+ ezno-parser-version :
11
+ description : " major/minor/patch or semver for parse"
12
+ required : false
13
+ default : " none"
14
+ ezno-checker-version :
15
+ description : " major/minor/patch or semver for type checker"
16
+ required : false
17
+ default : " none"
18
+ other-versions :
19
+ description : " comma seperated 'name=version_argument' pairs"
20
+ required : false
21
+ default : " none"
22
+
23
+ concurrency : release-crate
24
+
25
+ jobs :
26
+ crates-publish :
27
+ runs-on : ubuntu-latest
28
+ outputs :
29
+ new-ezno-version : ${{ steps.push.outputs.new-ezno-version }}
30
+ steps :
31
+ - uses : actions/checkout@v3
32
+ - name : Set git credentials
33
+ run : |
34
+ git config user.name github-actions
35
+ git config user.email github-actions@github.com
36
+ - id : set-arguments
37
+ run : |
38
+ $ARGS="ezno=${{ github.event.inputs.ezno-version }},ezno-parser=${{ github.event.inputs.ezno-parser-version }},ezno-checker=${{ github.event.inputs.ezno-checker-version }},${{ github.event.inputs.other-versions }}"
39
+ $VALUE=$(jq --raw-input 'split(",") | map(select(length > 0 and . != "none")) | map_values(split("=") | { (.[0]): .[1] }) | reduce .[] as $o ({}; . + $o)')
40
+ echo $VALUE
41
+ echo "publish-args=$VALUE" >> $GITHUB_OUTPUT
42
+ - name : Crates publish
43
+ uses : kaleidawave/crates-release-gh-action@main
44
+ id : release
45
+ with :
46
+ version : ${{ steps.set-arguments.outputs.publish-args }}
47
+ crates-token : ${{ secrets.CARGO_REGISTRY_TOKEN }}
48
+ - name : Push updated Cargo.toml
49
+ id : push
50
+ run : |
51
+ echo "new-ezno-version=$(echo '${{ steps.release.outputs.new-versions-json-object }}' | jq ".ezno" )" >> $GITHUB_OUTPUT
52
+ # Create tags
53
+ echo '${{ steps.release.outputs.new-versions }}' | jq -r '.[]' | while read -r update; do
54
+ git tag "release/$update"
55
+ done
56
+ git add .
57
+ git commit -m "Release: ${{ steps.release.outputs.new-versions-description }}"
58
+ git push --tags origin main
59
+ - name : Discord
60
+ uses : dusmartijngames/discord-webhook-notify@master
61
+ with :
62
+ severity : info
63
+ text : " Released version ${{ steps.release.outputs.new-versions-description }}"
64
+ webhookUrl : ${{ secrets.DISCORD_WEBHOOK_ENDPOINT }}
65
+
66
+ build :
67
+ if : ${{ github.event.inputs.ezno-version != 'none' }}
68
+ needs : crates-publish
69
+ strategy :
70
+ matrix :
71
+ os : [ubuntu-latest, windows-latest]
72
+ include :
73
+ - os : windows-latest
74
+ executable-extension : .exe
75
+ platform_name : x86_64-pc-windows
76
+ - os : ubuntu-latest
77
+ platform_name : x86_64-unknown-linux
78
+ runs-on : ${{ matrix.os }}
79
+ steps :
80
+ - uses : actions/checkout@v3
81
+ - name : Build binary
82
+ run : cargo build --release
83
+ - name : Rename and move release assets
84
+ run : |
85
+ mkdir artifacts
86
+ mv target/release/ezno${{ matrix.executable-extension }} artifacts/ezno-${{ needs.crates-publish.outputs.new-ezno-version }}-${{ matrix.platform_name }}${{ matrix.executable-extension }}
87
+ - uses : actions/upload-artifact@v3
88
+ with :
89
+ name : build-artifacts
90
+ path : artifacts/*
91
+ if-no-files-found : error
92
+ retention-days : 1
93
+
94
+ github-release :
95
+ if : ${{ github.event.inputs.ezno-version != 'none' }}
96
+ needs : [crates-publish, build]
97
+ runs-on : ubuntu-latest
98
+ steps :
99
+ - uses : actions/checkout@v2
100
+ - uses : actions/download-artifact@v3
101
+ with :
102
+ name : build-artifacts
103
+ path : build-artifacts
104
+ - name : GitHub release
105
+ uses : softprops/action-gh-release@v1
106
+ with :
107
+ body : " Release ${{ needs.crates-publish.outputs.new-ezno-version }}"
108
+ tag_name : " release/${{ needs.crates-publish.outputs.new-ezno-version }}"
109
+ files : |
110
+ README.md
111
+ build-artifacts/*
0 commit comments