From 413f6a818875f05eb608138e861f5296855036bd Mon Sep 17 00:00:00 2001 From: Rafal Janicki Date: Mon, 4 Mar 2024 13:38:30 +0100 Subject: [PATCH] Added CI/CD --- .github/workflows/dev-deployment.yml | 62 +++++++++++++++++++++++++ .github/workflows/master-deployment.yml | 37 +++++++++++++-- 2 files changed, 96 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/dev-deployment.yml diff --git a/.github/workflows/dev-deployment.yml b/.github/workflows/dev-deployment.yml new file mode 100644 index 000000000..d5e291dac --- /dev/null +++ b/.github/workflows/dev-deployment.yml @@ -0,0 +1,62 @@ +name: Test/Deploy Master + +on: + push: + branches: ['development'] + +jobs: + build-test: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.x] + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + - run: yarn install + - name: Eslint check + run: yarn run lint + + deploy-docs: + needs: build-test + runs-on: ubuntu-latest + steps: + - name: Trigger Developer Event + uses: peter-evans/repository-dispatch@main + with: + token: ${{ secrets.DOCS_REFRESH_TOKEN }} + repository: neo4j-documentation/docs-refresh + event-type: labs + + build-s3: + needs: build-test + runs-on: ubuntu-latest + environment: + name: development + url: https://development.graphapp.io/ + strategy: + matrix: + node-version: [ 18.x ] + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + - run: rm -rf docs + - run: yarn install + - run: yarn run build-minimal +# - run: curl ${{ vars.INDEX_HTML_DEPLOYMENT_URL }} > dist/index.html + - uses: kersvers/s3-sync-with-cloudfront-invalidation@v1.0.0 + with: + args: --delete + env: + AWS_ACCESS_KEY_ID: ${{ vars.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_S3_BUCKET: ${{ vars.AWS_S3_BUCKET }} + DISTRIBUTION_ID: ${{ vars.AWS_CDN_ID }} + AWS_REGION: 'us-east-1' + SOURCE_DIR: 'dist' \ No newline at end of file diff --git a/.github/workflows/master-deployment.yml b/.github/workflows/master-deployment.yml index db49e938d..e8dc69d23 100644 --- a/.github/workflows/master-deployment.yml +++ b/.github/workflows/master-deployment.yml @@ -11,14 +11,15 @@ jobs: matrix: node-version: [18.x] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - run: yarn install - name: Eslint check run: yarn run lint + deploy-docs: needs: build-test runs-on: ubuntu-latest @@ -28,4 +29,34 @@ jobs: with: token: ${{ secrets.DOCS_REFRESH_TOKEN }} repository: neo4j-documentation/docs-refresh - event-type: labs \ No newline at end of file + event-type: labs + + build-s3: + needs: build-test + runs-on: ubuntu-latest + environment: + name: production + url: https://graphapp.io/ + strategy: + matrix: + node-version: [ 18.x ] + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + - run: rm -rf docs + - run: yarn install + - run: yarn run build-minimal +# - run: curl ${{ vars.INDEX_HTML_DEPLOYMENT_URL }} > dist/index.html + - uses: kersvers/s3-sync-with-cloudfront-invalidation@v1.0.0 + with: + args: --delete + env: + AWS_ACCESS_KEY_ID: ${{ vars.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_S3_BUCKET: ${{ vars.AWS_S3_BUCKET }} + DISTRIBUTION_ID: ${{ vars.AWS_CDN_ID }} + AWS_REGION: 'us-east-1' + SOURCE_DIR: 'dist' \ No newline at end of file