We discovered that cancel-in-progress only controls in-progress jobs. Which means that pending jobs will _always_ be cancelled regardless. There is an open discussion: https://github.com/orgs/community/discussions/5435 which was closed saying this is how the feature is designed. We try to work around this by refactoring into separate reusable workflows and having concurrency only for PR workflows. ```release-note NONE ``` Co-authored-by: Mattermost Build <build@mattermost.com>
83 строки
3.6 KiB
YAML
83 строки
3.6 KiB
YAML
name: Artifacts generation and upload
|
|
on:
|
|
workflow_run:
|
|
workflows: ["Server CI Master", "Server CI PR"]
|
|
types:
|
|
- completed
|
|
|
|
jobs:
|
|
upload-s3:
|
|
name: cd/Upload artifacts to S3
|
|
runs-on: ubuntu-22.04
|
|
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
|
|
steps:
|
|
- name: cd/Configure AWS
|
|
uses: aws-actions/configure-aws-credentials@07c2f971bac433df982ccc261983ae443861db49 # v1-node16
|
|
with:
|
|
aws-region: us-east-1
|
|
aws-access-key-id: ${{ secrets.PR_BUILDS_BUCKET_AWS_ACCESS_KEY_ID }}
|
|
aws-secret-access-key: ${{ secrets.PR_BUILDS_BUCKET_AWS_SECRET_ACCESS_KEY }}
|
|
- name: cd/Download artifacts
|
|
uses: dawidd6/action-download-artifact@0c49384d39ceb023b8040f480a25596fd6cf441b # v2.26.0
|
|
with:
|
|
workflow: ${{ github.event.workflow_run.workflow_id }}
|
|
run_id: ${{ github.event.workflow_run.id }}
|
|
workflow_conclusion: success
|
|
name: server-dist-artifact
|
|
path: server/dist
|
|
- name: cd/Upload artifacts to S3
|
|
env:
|
|
REPO_NAME: ${{ github.event.repository.name }}
|
|
COMMIT_SHA: ${{ github.event.workflow_run.head_sha }}
|
|
run: |
|
|
aws s3 cp server/dist/ s3://pr-builds.mattermost.com/$REPO_NAME/commit/$COMMIT_SHA/ --acl public-read --cache-control "no-cache" --recursive --no-progress
|
|
|
|
build-docker:
|
|
name: cd/Build and push docker image
|
|
needs: upload-s3
|
|
runs-on: ubuntu-22.04
|
|
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
|
|
steps:
|
|
- name: cd/Login to Docker Hub
|
|
uses: docker/login-action@3da7dc6e2b31f99ef2cb9fb4c50fb0971e0d0139 # v2.1.0
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_DEV_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_DEV_TOKEN }}
|
|
- name: cd/Download artifacts
|
|
uses: dawidd6/action-download-artifact@0c49384d39ceb023b8040f480a25596fd6cf441b # v2.26.0
|
|
with:
|
|
workflow: ${{ github.event.workflow_run.workflow_id }}
|
|
run_id: ${{ github.event.workflow_run.id }}
|
|
workflow_conclusion: success
|
|
name: server-build-artifact
|
|
path: server/build/
|
|
- name: cd/Setup Docker Buildx
|
|
uses: docker/setup-buildx-action@11e8a2e2910826a92412015c515187a2d6750279 # v2.4
|
|
- name: cd/Docker build and push
|
|
env:
|
|
DOCKER_CLI_EXPERIMENTAL: enabled
|
|
REPO_NAME: ${{ github.event.repository.name }}
|
|
COMMIT_SHA: ${{ github.event.workflow_run.head_sha }}
|
|
run: |
|
|
export TAG=$(echo "${{ github.event.pull_request.head.sha || github.event.workflow_run.head_sha }}" | cut -c1-7)
|
|
cd server/build
|
|
export DOCKER_CLI_EXPERIMENTAL=enabled
|
|
export MM_PACKAGE=https://pr-builds.mattermost.com/$REPO_NAME/commit/$COMMIT_SHA/mattermost-team-linux-amd64.tar.gz
|
|
docker buildx build --push --build-arg MM_PACKAGE=$MM_PACKAGE -t mattermostdevelopment/mm-te-test:${TAG} .
|
|
|
|
sentry:
|
|
name: Send build info to sentry
|
|
if: >
|
|
github.event.workflow_run.event == 'push'
|
|
runs-on: ubuntu-22.04
|
|
env:
|
|
SENTRY_AUTH_TOKEN: ${{ secrets.MM_SERVER_SENTRY_AUTH_TOKEN }}
|
|
SENTRY_ORG: ${{ secrets.MM_SERVER_SENTRY_ORG }}
|
|
SENTRY_PROJECT: ${{ secrets.MM_SERVER_SENTRY_PROJECT }}
|
|
steps:
|
|
- name: cd/Checkout mattermost-server
|
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
|
- name: cd/Create Sentry release
|
|
uses: getsentry/action-release@85e0095193a153d57c458995f99d0afd81b9e5ea # v1.3.0
|
|
|