Skip to content

Merge remote-tracking branch 'origin/master' into merge-master #203

Merge remote-tracking branch 'origin/master' into merge-master

Merge remote-tracking branch 'origin/master' into merge-master #203

name: Build and Publish Marketplace
on:
push:
jobs:
build:
runs-on: ubuntu-22.04
container: cimg/go:1.22
defaults:
run:
shell: bash
steps:
- name: build/checkout-repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
- name: build/ensure-master-exists
run: git rev-parse --verify master >/dev/null 2>&1 || git branch master origin/master
- name: build/check-style
run: make check-style
- name: build/test
run: make test
- name: build/build
run: make build
- name: build/package-artifact
run: make package-artifact
- name: build/check-uncommitted-changes
run: |
# Assert that 'git status --porcelain' does not produce output
[ -z "$(git status --porcelain)" ] || {
echo "ERROR: uncommitted changes"
git status --porcelain
exit 1
}
- name: build/persist-build
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: marketplace-build
path: dist/mattermost-marketplace.zip
retention-days: 2
compression-level: 0
deploy:
if: ${{ github.repository == 'mattermost/mattermost-marketplace' && (github.ref_name == 'master' || github.ref_name == 'production') }}
runs-on: ubuntu-22.04
container: node:20
needs:
- build
defaults:
run:
shell: bash
env:
AWS_DEFAULT_REGION: us-east-1
steps:
- name: deploy/checkout-repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
- name: deploy/install-dependencies
run: npm i -g "serverless@<4.0.0"
- name: deploy/download-build
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
name: marketplace-build
path: dist
# Required because of https://github.com/actions/upload-artifact/issues/38
- name: deploy/set-artifact-permissions
run: chmod +x dist/*
- name: deploy/master-branch
if: ${{ github.ref_name == 'master' }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.MM_MARKETPLACE_AWS_ACCESS_KEY_ID_STAGING }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.MM_MARKETPLACE_AWS_SECRET_ACCESS_KEY_STAGING }}
run: serverless deploy function -f server --stage staging --verbose
- name: deploy/production-branch
if: ${{ github.ref_name == 'production' }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.MM_MARKETPLACE_AWS_ACCESS_KEY_ID_PRODUCTION }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.MM_MARKETPLACE_AWS_SECRET_ACCESS_KEY_PRODUCTION }}
run: serverless deploy function -f server --stage production --verbose