From b61f65daa979f37e54e0cef6ed4707b6951ce18a Mon Sep 17 00:00:00 2001 From: Antonis Stamatiou Date: Thu, 11 Apr 2024 12:14:19 +0300 Subject: [PATCH] feat: Introduce community plugin reusable action workflows --- .github/workflows/community-plugin-cd.yml | 47 ++++++++++++++++ .github/workflows/community-plugin-ci.yml | 68 +++++++++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100644 .github/workflows/community-plugin-cd.yml create mode 100644 .github/workflows/community-plugin-ci.yml diff --git a/.github/workflows/community-plugin-cd.yml b/.github/workflows/community-plugin-cd.yml new file mode 100644 index 0000000..007d088 --- /dev/null +++ b/.github/workflows/community-plugin-cd.yml @@ -0,0 +1,47 @@ +on: + workflow_call: + inputs: + golang-version: + default: "1.21" + description: | + Set the version for golang + required: false + type: string + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: cd/checkout-repo + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + fetch-depth: 0 + + - name: cd/setup-plugin-environment + uses: mattermost/actions/plugin-ci/setup@main + with: + golang-version: ${{ inputs.golang-version }} + + - name: cd/build-plugin + uses: mattermost/actions/plugin-ci/build@main + + release-github: + runs-on: ubuntu-latest + needs: + - build + steps: + - name: cd/checkout-repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + fetch-depth: "0" + + - name: cd/download-artifact + uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4 + with: + name: dist + path: dist + + - name: ci/publish-release + working-directory: dist + run: | + gh release create "$GITHUB_REF_NAME" --title "$GITHUB_REF_NAME" --notes-file release-notes.md *.tar.gz diff --git a/.github/workflows/community-plugin-ci.yml b/.github/workflows/community-plugin-ci.yml new file mode 100644 index 0000000..ea84823 --- /dev/null +++ b/.github/workflows/community-plugin-ci.yml @@ -0,0 +1,68 @@ +on: + workflow_call: + inputs: + golangci-lint-version: + default: "v1.55.2" + description: | + Set the version for golangci-lint + required: false + type: string + + golang-version: + default: "1.21" + description: | + Set the version for golang + required: false + type: string + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: ci/checkout-repo + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + fetch-depth: 0 + + - name: ci/setup + uses: mattermost/actions/plugin-ci/setup@main + with: + golangci-lint-version: ${{ inputs.golangci-lint-version }} + golang-version: ${{ inputs.golang-version }} + + - name: ci/lint + uses: mattermost/actions/plugin-ci/lint@main + + test: + runs-on: ubuntu-latest + steps: + - name: ci/checkout-repo + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + fetch-depth: 0 + + - name: ci/setup + uses: mattermost/actions/plugin-ci/setup@main + with: + golangci-lint-version: ${{ inputs.golangci-lint-version }} + golang-version: ${{ inputs.golang-version }} + + - name: ci/test + uses: mattermost/actions/plugin-ci/test@main + + build: + runs-on: ubuntu-latest + steps: + - name: ci/checkout-repo + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + fetch-depth: 0 + + - name: ci/setup + uses: mattermost/actions/plugin-ci/setup@main + with: + golang-version: ${{ inputs.golang-version }} + golangci-lint-version: ${{ inputs.golangci-lint-version }} + + - name: ci/build + uses: mattermost/actions/plugin-ci/build@main