Skip to content

Commit

Permalink
Merge branch 'master' into justinegeffen-patch-4
Browse files Browse the repository at this point in the history
  • Loading branch information
justinegeffen authored Aug 2, 2021
2 parents 7bd115a + b058d1e commit 71c259d
Show file tree
Hide file tree
Showing 366 changed files with 7,491 additions and 1,509 deletions.
21 changes: 4 additions & 17 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- run:
name: build Hugo
environment:
HUGO_VERSION: 0.67.1
HUGO_VERSION: 0.74.2
command: |
wget https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-64bit.tar.gz -O /tmp/hugo.tar.gz
tar -xvf /tmp/hugo.tar.gz hugo
Expand All @@ -33,18 +33,6 @@ jobs:
from: dist/html
to: s3://mattermost-developer-documentation/branches/$CIRCLE_BRANCH
arguments: '--acl public-read'
- aws-s3/sync:
from: dist/html
to: s3://mattermost-developer-documentation/commits/$CIRCLE_SHA1
arguments: '--acl public-read'

status:
docker:
- image: circleci/python:3.6
steps:
- run:
name: Reporting status to GitHub
command: 'curl -H "Authorization: token $GITHUB_TOKEN" --data "{\"state\": \"success\", \"target_url\": \"http://mattermost-developer-documentation.s3-website-us-east-1.amazonaws.com/commits/<< pipeline.git.revision >>\", \"description\": \"Deployed to S3\", \"context\": \"Continuous Deployment\"}" "https://api.github.com/repos/mattermost/mattermost-developer-documentation/statuses/<< pipeline.git.revision >>"'

workflows:
version: 2
Expand All @@ -55,7 +43,6 @@ workflows:
context: mattermost-dev-docs-s3
requires:
- build
- status:
context: matterbuild-github-token
requires:
- deploy
filters:
branches:
only: master
21 changes: 21 additions & 0 deletions .github/workflows/check-label.yml
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
39 changes: 0 additions & 39 deletions .github/workflows/gh-pages-cleanup.yml

This file was deleted.

63 changes: 0 additions & 63 deletions .github/workflows/gh-pages.yml

This file was deleted.

2 changes: 0 additions & 2 deletions .github/workflows/notify-mm-blog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,3 @@ jobs:
- uses: mattermost/action-mattermost-notify@master
env:
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }}


104 changes: 104 additions & 0 deletions .github/workflows/preview-env-fork.yml
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.
46 changes: 46 additions & 0 deletions .github/workflows/preview-env.yml
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 }}
13 changes: 0 additions & 13 deletions CODEOWNERS

This file was deleted.

2 changes: 0 additions & 2 deletions Makefile
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
Expand Down
6 changes: 3 additions & 3 deletions go.mod
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
)
Loading

0 comments on commit 71c259d

Please sign in to comment.