-
Notifications
You must be signed in to change notification settings - Fork 399
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into justinegeffen-patch-4
- Loading branch information
Showing
366 changed files
with
7,491 additions
and
1,509 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: check-label-preview-env | ||
|
||
on: | ||
pull_request: | ||
types: [labeled] | ||
|
||
jobs: | ||
check-label-preview-env: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: check-label | ||
if: contains(github.event.pull_request.labels.*.name, 'preview-environment') | ||
run: echo "label exist, will trigger the preview environment" | ||
- name: Set PR | ||
run: echo ${{ github.event.pull_request.number }} > pr.txt | ||
- name: Save PR | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: pr.txt | ||
path: | | ||
pr.txt |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
name: preview-env-fork-setup-update | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["check-label-preview-env"] | ||
types: [completed] | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download PR number artifact | ||
if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
uses: dawidd6/action-download-artifact@v2 | ||
with: | ||
workflow: ${{ github.event.workflow_run.workflow_id }} | ||
name: pr.txt | ||
- name: Save PR number | ||
if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
id: pr | ||
run: | | ||
cat pr.txt | ||
echo "::set-output name=id::$(<pr.txt)" | ||
- name: Check label | ||
if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
uses: actions/github-script@v4 | ||
id: label-checker | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
const query = `query($owner:String!, $name:String!, $pr:Int!) { | ||
repository(owner:$owner, name:$name){ | ||
pullRequest(number:$pr) { | ||
labels(first:50) { | ||
nodes{ | ||
name | ||
} | ||
} | ||
} | ||
} | ||
}`; | ||
const variables = { | ||
owner: 'mattermost', | ||
name: 'docs', | ||
pr: ${{ steps.pr.outputs.id }} | ||
}; | ||
const result = await github.graphql(query, variables); | ||
console.log(result.repository.pullRequest.labels.nodes); | ||
const labels = result.repository.pullRequest.labels.nodes; | ||
for (var index = 0; index < labels.length; ++index) { | ||
var label = labels[index]; | ||
if(label.name == 'preview-environment') { | ||
return true; | ||
} | ||
} | ||
return false; | ||
- uses: actions/checkout@v2 | ||
if: ${{ github.event.workflow_run.conclusion == 'success' && steps.label-checker.outputs.result == 'true' }} | ||
with: | ||
ref: ${{ github.event.workflow_run.head_sha }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
submodules: true | ||
fetch-depth: 0 | ||
|
||
- name: Setup Hugo | ||
if: ${{ github.event.workflow_run.conclusion == 'success' && steps.label-checker.outputs.result == 'true' }} | ||
uses: peaceiris/actions-hugo@v2 | ||
with: | ||
hugo-version: '0.74.2' | ||
# extended: true | ||
|
||
- name: Build Previews | ||
if: ${{ github.event.workflow_run.conclusion == 'success' && steps.label-checker.outputs.result == 'true' }} | ||
run: | | ||
rm -rf ./dist | ||
hugo -F -s site --baseURL http://mattermost-dev-docs-preview-pulls.s3-website-us-east-1.amazonaws.com/ --destination ../dist/html | ||
- uses: shallwefootball/s3-upload-action@master | ||
name: Upload Preview Env | ||
if: ${{ github.event.workflow_run.conclusion == 'success' && steps.label-checker.outputs.result == 'true' }} | ||
with: | ||
aws_key_id: ${{ secrets.AWS_KEY_ID }} | ||
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws_bucket: ${{ secrets.AWS_BUCKET }} | ||
source_dir: ./dist/html | ||
destination_dir: ${{ steps.pr.outputs.id }} | ||
|
||
- name: Add comment to PR | ||
uses: peter-evans/create-or-update-comment@v1 | ||
if: ${{ success() && github.event.workflow_run.conclusion == 'success' && steps.label-checker.outputs.result == 'true' }} | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
issue-number: ${{ steps.pr.outputs.id }} | ||
body: | | ||
Newest code from ${{ github.actor }} has been published to [preview environment](http://mattermost-dev-docs-preview-pulls.s3-website-us-east-1.amazonaws.com/${{ steps.pr.outputs.id }}) for Git SHA ${{ github.event.workflow_run.head_sha }} | ||
- name: The job has failed | ||
if: ${{ failure() && github.event.workflow_run.conclusion == 'success' && steps.label-checker.outputs.result == 'true' }} | ||
uses: peter-evans/create-or-update-comment@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
issue-number: ${{ steps.pr.outputs.id }} | ||
body: Preview environment failed. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: preview-env-setup-update | ||
|
||
on: | ||
pull_request: | ||
types: [assigned, opened, reopened, synchronize] | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
if: github.event.pull_request.head.repo.full_name == github.repository | ||
with: | ||
submodules: true | ||
fetch-depth: 0 | ||
|
||
- name: Setup Hugo | ||
if: github.event.pull_request.head.repo.full_name == github.repository | ||
uses: peaceiris/actions-hugo@v2 | ||
with: | ||
hugo-version: '0.74.2' | ||
|
||
- name: Build Previews | ||
if: github.event.pull_request.head.repo.full_name == github.repository | ||
run: | | ||
rm -rf ./dist | ||
hugo -F -s site --baseURL http://mattermost-dev-docs-preview-pulls.s3-website-us-east-1.amazonaws.com/${{ github.event.number }}/ --destination ../dist/html | ||
- uses: shallwefootball/s3-upload-action@master | ||
name: Upload Preview Env | ||
if: github.event.pull_request.head.repo.full_name == github.repository | ||
with: | ||
aws_key_id: ${{ secrets.AWS_KEY_ID }} | ||
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws_bucket: ${{ secrets.AWS_BUCKET }} | ||
source_dir: ./dist/html | ||
destination_dir: ${{ github.event.number }} | ||
|
||
- name: Add comment to PR | ||
if: github.event.pull_request.head.repo.full_name == github.repository | ||
uses: peter-evans/create-or-update-comment@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
issue-number: ${{ github.event.number }} | ||
body: | | ||
Newest code from ${{ github.actor }} has been published to [preview environment](http://mattermost-dev-docs-preview-pulls.s3-website-us-east-1.amazonaws.com/${{ github.event.number }}) for Git SHA ${{ github.event.pull_request.head.sha }} |
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
include legacy.mk | ||
|
||
.PHONY: dist | ||
dist: plugin-data | ||
rm -rf ./dist | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
module mattermost-developer-documentation | ||
|
||
go 1.13 | ||
go 1.15 | ||
|
||
require ( | ||
github.com/mattermost/mattermost-server/v5 v5.28.0 | ||
github.com/mattermost/mattermost-server/v5 v5.33.0 | ||
github.com/pkg/errors v0.9.1 | ||
golang.org/x/tools v0.0.0-20200818005847-188abfa75333 | ||
golang.org/x/tools v0.1.0 | ||
) |
Oops, something went wrong.