-
-
Notifications
You must be signed in to change notification settings - Fork 46
159 lines (134 loc) · 5.32 KB
/
publish.yml
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: Release on Crates and NPM
on:
workflow_dispatch:
inputs:
ezno-version:
description: "major/minor/patch or semver for Ezno (cli)"
required: false
default: "none"
ezno-checker-version:
description: "major/minor/patch or semver for the type checker"
required: false
default: "none"
ezno-parser-version:
description: "major/minor/patch or semver for the parser"
required: false
default: "none"
other-versions:
description: "comma seperated 'name=version_argument' pairs"
required: false
default: "none"
concurrency: release-crate
env:
CACHE_PATHS: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ${{ env.CACHE_PATHS }}
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Set git credentials
run: |
git config user.name github-actions
git config user.email [email protected]
- id: set-arguments
run: |
KEY_PAIR_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 }}"
echo "::debug::$KEY_PAIR_ARGS"
KEY_PAIR_ARGS_JSON=$(echo $KEY_PAIR_ARGS | jq --raw-input --compact-output 'split(",") | map(select(length > 0 and . != "none")) | map_values(split("=") | { (.[0]): .[1] }) | reduce .[] as $o ({}; . + $o)')
echo "::debug::$KEY_PAIR_ARGS_JSON"
echo "publish-json-args=$KEY_PAIR_ARGS_JSON" >> $GITHUB_OUTPUT
shell: bash
- id: get-sponsors
run: |
SPONSORS=$(gh api graphql -f query='{
user(login: "kaleidawave") {
sponsorshipsAsMaintainer(first: 100, activeOnly: false) {
edges {
node {
sponsor {
login
}
}
}
}
}
}' -q '.data.user.sponsorshipsAsMaintainer.edges | map(.node.sponsor.login) | join(", ")')
echo "sponsors=$SPONSORS" >> $GITHUB_OUTPUT
shell: bash
env:
GH_TOKEN: ${{ github.token }}
- name: Crates publish
uses: kaleidawave/crates-release-gh-action@main
id: release
with:
version: ${{ steps.set-arguments.outputs.publish-json-args }}
crates-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
env:
SPONSORS: ${{ steps.get-sponsors.outputs.sponsors }}
- name: Add WASM to rustup
if: ${{ github.event.inputs.ezno-version != 'none' }}
run: rustup target add wasm32-unknown-unknown
- uses: brndnmtthws/rust-action-cargo-binstall@v1
if: ${{ github.event.inputs.ezno-version != 'none' }}
with:
packages: [email protected]
- name: Set NPM package version & build
id: set-npm-version
if: ${{ github.event.inputs.ezno-version != 'none' }}
run: |
VERSION=$(echo '${{ steps.release.outputs.new-versions-json-object }}' | jq -r '.ezno')
echo "new-ezno-version=${VERSION}" >> $GITHUB_OUTPUT
npm ci
npm version $VERSION
npm run build-release
# TODO temp check
ls dist
working-directory: src/js-cli-and-library
env:
SPONSORS: ${{ steps.get-sponsors.outputs.sponsors }}
- name: NPM publish (cli and library)
if: ${{ github.event.inputs.ezno-version != 'none' }}
uses: rxfork/npm-publish@v1
with:
token: ${{ secrets.NPM_REGISTRY_TOKEN }}
package: src/js-cli-and-library/package.json
- name: Update JS plugin version and dependencies
if: ${{ github.event.inputs.ezno-version != 'none' }}
run: |
# Hopefully propagated in 20 seconds
sleep 20
npm ci
npm install ezno@${{ steps.set-npm-version.outputs.new-ezno-version }}
npm version ${{ steps.set-npm-version.outputs.new-ezno-version }}
working-directory: src/js-based-plugin
- name: NPM publish (plugin)
uses: rxfork/npm-publish@v1
with:
token: ${{ secrets.NPM_REGISTRY_TOKEN }}
package: src/js-based-plugin/package.json
- name: Push updated manifests (Cargo.toml and package.json)
run: |
git add .
git commit -m "Release: ${{ steps.release.outputs.new-versions-description }}"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
# Create tags
echo '${{ steps.release.outputs.new-versions }}' | jq -r '.[]' | while read -r update; do
git tag "release/$update"
done
git push --tags origin main
- name: Discord
uses: dusmartijngames/discord-webhook-notify@master
with:
severity: info
text: "Released version ${{ steps.release.outputs.new-versions-description }}"
webhookUrl: ${{ secrets.DISCORD_WEBHOOK_ENDPOINT }}