You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

96 lines
3.1 KiB

name: Package and release
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
DEBIAN_RELEASE: buster
DOCKER_PWD: /root
DOCKER_IMAGE: debian:${DEBIAN_RELEASE}
GO_VERSION: 1.16.7
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- os: dragonfly
arch: amd64
- os: freebsd
arch: amd64
- os: freebsd
arch: arm
- os: linux
arch: arm
- os: linux
arch: arm64
- os: linux
arch: mips
- os: linux
arch: mips64
- os: linux
arch: mips64le
- os: linux
arch: mipsle
- os: linux
arch: ppc64
- os: linux
arch: ppc64le
- os: linux
arch: s390x
- os: netbsd
arch: amd64
- os: netbsd
arch: arm
- os: openbsd
arch: amd64
- os: openbsd
arch: arm
steps:
- name: Clone repository
uses: actions/checkout@v2
- name: Set environment from runtime properties
run: |
echo "MATTERMOST_RELEASE=$(grep 'mattermost-server' dependabot/go.mod | cut -d' ' -f2)" >> $GITHUB_ENV
echo "MMCTL_RELEASE=$MATTERMOST_RELEASE" >> $GITHUB_ENV
- name: Pull docker image
run: 'docker pull "${{ env.DOCKER_IMAGE }}"'
- name: Build
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
run: docker run --mount="type=bind,source=$PWD,destination=${{ env.DOCKER_PWD }}" --rm=true --tty=true --workdir="${{ env.DOCKER_PWD }}" -e DEBIAN_RELEASE -e MATTERMOST_RELEASE -e MMCTL_RELEASE -e GOOS -e GOARCH "${{ env.DOCKER_IMAGE }}" ./build.sh
- name: Tag release
if: github.ref == 'refs/heads/master'
uses: actions/github-script@v3
# this throws an error if the tag already exists. can't find a way around that without writing our own Github REST client or forking github's scripts repo.
# would prefer to do this before any of these jobs run, but we need to know the mattermost version which only happens after a clone. could potentially
# setup a separate job which does clone + tag, but felt like this was "good enough" for now.
continue-on-error: true
with:
script: |
github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ env.MATTERMOST_RELEASE }}',
sha: context.sha
})
- name: Create Github release
if: github.ref == 'refs/heads/master'
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.MATTERMOST_RELEASE }}
files: |
mattermost-${{ env.MATTERMOST_RELEASE }}-${{ matrix.os }}-${{ matrix.arch }}.tar.gz
mattermost-${{ env.MATTERMOST_RELEASE }}-${{ matrix.os }}-${{ matrix.arch }}.tar.gz.sha512sum