2023-05-16 10:06:07 +02:00
|
|
|
name: 'Notify enterprise of commit in main'
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
2023-07-04 17:34:35 +02:00
|
|
|
paths-ignore:
|
|
|
|
- website/**
|
|
|
|
- coverage/**
|
2023-05-16 10:06:07 +02:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-05-23 14:14:09 +02:00
|
|
|
node-version: [20.x]
|
2023-05-16 10:06:07 +02:00
|
|
|
|
|
|
|
steps:
|
2023-10-05 10:19:57 +02:00
|
|
|
- uses: actions/checkout@v4
|
2023-05-23 23:27:44 +02:00
|
|
|
- name: Trigger sync
|
2024-01-09 18:53:50 +01:00
|
|
|
uses: actions/github-script@v7
|
2023-07-05 13:35:12 +02:00
|
|
|
env:
|
|
|
|
COMMIT_ACTOR: ${{ github.event.commits[0].author.name }} <${{ github.event.commits[0].author.email }}>
|
2023-05-23 23:27:44 +02:00
|
|
|
with:
|
|
|
|
github-token: ${{ secrets.UNLEASH_CI_BUILDER_GITHUB_TOKEN }}
|
|
|
|
script: |
|
|
|
|
await github.rest.actions.createWorkflowDispatch({
|
|
|
|
owner: 'ivarconr',
|
|
|
|
repo: 'unleash-enterprise',
|
|
|
|
workflow_id: 'cicd.yaml',
|
|
|
|
ref: 'master',
|
|
|
|
inputs: {
|
|
|
|
commit: "${{ github.event.head_commit.id }}",
|
2023-07-06 09:52:50 +02:00
|
|
|
actor: ${{ toJSON(env.COMMIT_ACTOR) }},
|
2023-05-23 23:27:44 +02:00
|
|
|
message: ${{ toJSON(github.event.head_commit.message) }},
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
# build static assets after triggering the sync workflow.
|
|
|
|
# Adding a validation step in the sync workflow will ensure that the static assets are built before deployment.
|
2023-05-16 10:06:07 +02:00
|
|
|
- name: Build static assets
|
|
|
|
run: |
|
|
|
|
cd frontend
|
|
|
|
yarn install --frozen-lockfile
|
|
|
|
yarn build
|
2023-06-06 15:03:11 +02:00
|
|
|
- uses: aws-actions/configure-aws-credentials@v2
|
2023-05-16 10:06:07 +02:00
|
|
|
with:
|
|
|
|
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
|
|
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
|
|
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
|
2023-05-16 10:44:50 +02:00
|
|
|
- name: Get the commit hash
|
|
|
|
id: get_commit_hash
|
|
|
|
run: |
|
|
|
|
COMMIT_HASH=${{ github.sha }}
|
|
|
|
echo "Commit hash: $COMMIT_HASH"
|
|
|
|
echo "::set-output name=COMMIT_HASH::$COMMIT_HASH"
|
2023-05-16 10:06:07 +02:00
|
|
|
- name: Publish static assets to S3
|
|
|
|
run: |
|
2023-05-16 12:36:17 +02:00
|
|
|
aws s3 cp frontend/build s3://getunleash-static/unleash/commits/${{ steps.get_commit_hash.outputs.COMMIT_HASH }} --recursive
|