Restrict build workflow permissions and only trigger on main branch #87
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
permissions: {} | |
jobs: | |
package: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout version | |
uses: actions/checkout@v4 | |
with: | |
path: tmp | |
sparse-checkout: VERSION | |
sparse-checkout-cone-mode: false | |
- name: Read version | |
id: version | |
run: | | |
echo "version=$(cat tmp/VERSION)" >> "$GITHUB_OUTPUT" | |
# Need an empty directory for next step | |
rm -rf tmp | |
- name: Checkout mattermost | |
uses: actions/checkout@v4 | |
with: | |
repository: mattermost/mattermost | |
ref: ${{ steps.version.outputs.version }} | |
- name: Checkout patches | |
uses: actions/checkout@v4 | |
with: | |
path: patch | |
- name: Apply patches | |
run: for i in ./patch/*.patch; do patch -p1 < "$i"; done | |
- name: Add overlay | |
run: cp -R ./patch/overlay/* ./ | |
- name: Build server | |
uses: ./patch/build-server | |
- name: Build client | |
uses: ./patch/build-client | |
- name: Package | |
uses: ./patch/package | |
- name: Upload Build Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
path: server/dist/mattermost-team-linux-amd64.tar.gz |