LP-2725: plugin ci template & actions

This commit is contained in:
2023-12-26 11:53:21 +03:00
parent 627bd4e231
commit fb31170009
4 changed files with 266 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
name: sign
description: Sign file
inputs:
private_key:
required: true
description: 'Private key'
private_key_id:
required: true
description: 'Private key id'
private_key_passphrase:
required: true
description: 'Private key passphrase'
filepath:
required: true
description: 'Absolute or relative for workdir file path for sign'
runs:
using: composite
steps:
- name: ci/protect-sensitive
shell: bash
run: |
echo ::add-mask::$INPUT_PRIVATE_KEY
echo ::add-mask::$INPUT_PRIVATE_KEY_ID
echo ::add-mask::$INPUT_PRIVATE_KEY_PASSPHRASE
- name: ci/import-private-key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ inputs.private_key }}
passphrase: ${{ inputs.private_key_passphrase }}
- name: ci/sign
shell: bash
run: gpg -u ${{ inputs.private_key_id }} --verbose --personal-digest-preferences SHA256 --detach-sign ${{ inputs.filepath }}
+50
View File
@@ -0,0 +1,50 @@
name: build
description: Build plugin via yarn & make
inputs:
go_version:
required: false
description: 'GO version'
node_version:
required: false
description: 'Node.js version'
runs:
using: composite
steps:
- name: ci/setup-go
uses: actions/setup-go@v4
if: ${{ inputs.go_version }}
with:
go-version: "${{ inputs.go_version }}"
cache-dependency-path: |
go.sum
server/go.sum
- name: ci/setup-node
uses: actions/setup-node@v4
if: ${{ inputs.node_version }}
with:
node-version: "${{ inputs.node_version }}"
# TODO cache yarn
# cache: "yarn"
# cache-dependency-path: yarn.lock
# TODO tests
# - name: ci/plugin-test
- name: ci/install-deps
if: ${{ inputs.node_version }}
shell: bash
run: |
echo "::group::yarn"
cd webapp
yarn install
echo "::endgroup::"
- name: ci/plugin-build
shell: bash
run: |
echo "::group::dist"
make dist
echo "::endgroup::"
+49
View File
@@ -0,0 +1,49 @@
name: json
description: Build plugin json for marketplace
inputs:
plugin_id:
required: true
description: 'Plugin id'
plugin_version:
required: true
description: 'Plugin version'
enterprise:
required: true
description: 'Is plugin enterprise'
beta:
required: true
description: 'Is plugin beta'
experimental:
required: true
description: 'Is plugin experimental'
artifacts_url:
required: true
description: 'Artifacts URL'
artifacts_repository:
required: true
description: 'Artifacts repository'
runs:
using: composite
steps:
- name: ci/install-marketplace
shell: bash
run: |
git clone --branch production https://github.com/mattermost/mattermost-marketplace.git ./marketplace
git -C ./marketplace reset --hard 3d2177a488d01887de993364c36afc62cd7ab416
echo [] > ./marketplace/plugins.json
- name: ci/add-json
shell: bash
run: |
cd marketplace
args=""
if [ "${{ inputs.enterprise }}" = true ]; then args+=" --enterprise"; fi
if [ "${{ inputs.beta }}" = true ]; then args+=" --beta"; fi
if [ "${{ inputs.experimental }}" = true ]; then args+=" --experimental"; fi
go run ./cmd/generator/ add ${{ inputs.plugin_id }} ${{ inputs.plugin_version }} --official --remote-plugin-store=${{ inputs.artifacts_url }}/repository/${{ inputs.artifacts_repository }}/plugins/${{ inputs.plugin_id }}/${{ inputs.plugin_version }} $args
- name: ci/extract-json
shell: bash
run: jq '.[0] | .author_type = "loop"' ./marketplace/plugins.json >> ./dist/${{ inputs.plugin_id }}-${{ inputs.plugin_version }}.tar.gz.json