10
10
overridden_plugin_version:
11
11
required: false
12
12
type: string
13
+ plugin_name:
14
+ required: true
15
+ type: string
13
16
14
17
jobs:
15
18
check-uploaded:
16
- name: Check snforge_scarb_plugin Version
19
+ name: Check ${{ inputs.plugin_name }} Version
17
20
runs-on: ubuntu-latest
18
21
outputs:
19
22
plugin_uploaded: ${{ steps.check-uploaded.outputs.plugin_uploaded }}
@@ -26,14 +29,16 @@ jobs:
26
29
27
30
source scripts/handle_version.sh
28
31
29
- snforge_scarb_plugin_version=$(get_version "${{ inputs.overridden_plugin_version }}")
32
+ plugin_name_underscores=${{ inputs.plugin_name }}
33
+ plugin_name_underscores=${plugin_name_underscores//-/_}
34
+ plugin_version=$(get_version "${{ inputs.overridden_plugin_version }}")
30
35
31
36
registry_url=${{ inputs.prod_registry == true && 'https://scarbs.xyz' || 'https://scarbs.dev' }}
32
- plugin_uploaded=$(curl -s ${registry_url}/api/v1/index/sn/fo/snforge_scarb_plugin .json | jq --arg version "$snforge_scarb_plugin_version " '[.[] | select(.v == $version)] | length > 0')
37
+ plugin_uploaded=$(curl -s ${registry_url}/api/v1/index/sn/fo/${plugin_name_underscores} .json | jq --arg version "$plugin_version " '[.[] | select(.v == $version)] | length > 0')
33
38
echo "plugin_uploaded=$plugin_uploaded" >> $GITHUB_OUTPUT
34
39
35
40
upload-to-registry:
36
- name: Upload snforge_scarb_plugin to the registry
41
+ name: Upload ${{ inputs.plugin_name }} to the registry
37
42
runs-on: ubuntu-latest
38
43
needs: [check-uploaded]
39
44
env:
42
47
- uses: actions/checkout@v4
43
48
- uses: dtolnay/rust-toolchain@stable
44
49
- uses: software-mansion/setup-scarb@v1
45
- with:
46
- # TODO(#3144) Remove
47
- scarb-version: "2.11.4"
48
50
49
51
- name: Download artifacts
50
52
uses: actions/download-artifact@v4
@@ -54,27 +56,30 @@ jobs:
54
56
- name: Unpack artifacts to target directory
55
57
run: |
56
58
set -euxo pipefail
57
- mkdir -p crates/snforge-scarb-plugin/target/scarb/cairo-plugin
58
59
59
- mv artifacts-dl/build-plugin-*/snforge_scarb_plugin_v* crates/snforge-scarb-plugin/target/scarb/cairo-plugin/
60
+ plugin_name_underscores=${{ inputs.plugin_name }}
61
+ plugin_name_underscores=${plugin_name_underscores//-/_}
62
+
63
+ mkdir -p crates/${{ inputs.plugin_name }}/target/scarb/cairo-plugin
64
+ mv artifacts-dl/build-*/${plugin_name_underscores}_v* crates/${{ inputs.plugin_name }}/target/scarb/cairo-plugin/
60
65
61
66
# Required for testing prebuild plugin while creating release.
62
67
if [[ -n "${{ inputs.overridden_plugin_version }}" ]]; then
63
- cd crates/snforge-scarb-plugin /target/scarb/cairo-plugin/
68
+ cd crates/${{ inputs.plugin_name }} /target/scarb/cairo-plugin/
64
69
overridden_version="${{ inputs.overridden_plugin_version }}"
65
70
66
- for file in snforge_scarb_plugin_v *; do
67
- if [[ -f "$file" && ! "$file" =~ "snforge_scarb_plugin_v ${overridden_version}" ]]; then
68
- platform=$(echo "$file" | sed -E 's/snforge_scarb_plugin_v [0-9]+\.[0-9]+\.[0-9]+([-.].*)?_(.+)/\2/' )
69
- new_file="snforge_scarb_plugin_v ${overridden_version}_${platform}"
71
+ for file in ${plugin_name_underscores}_v *; do
72
+ if [[ -f "$file" && ! "$file" =~ "${plugin_name_underscores}_v ${overridden_version}" ]]; then
73
+ platform=$(echo "$file" | sed -E "s/${plugin_name_underscores}_v [0-9]+\.[0-9]+\.[0-9]+([-.].*)?_(.+)/\2/" )
74
+ new_file="${plugin_name_underscores}_v ${overridden_version}_${platform}"
70
75
mv "$file" "$new_file"
71
76
fi
72
77
done
73
78
fi
74
79
75
- - name: Publish snforge_scarb_plugin
80
+ - name: Publish ${{ inputs.plugin_name }}
76
81
if: needs.check-uploaded.outputs.plugin_uploaded == 'false' || github.event_name == 'workflow_dispatch'
77
- working-directory: crates/snforge-scarb-plugin
82
+ working-directory: crates/${{ inputs.plugin_name }}
78
83
run: |
79
84
set -exo pipefail
80
85
source ../../scripts/handle_version.sh
0 commit comments