From 2488b9b305716042b2cd1415bc4f06b8a2bda670 Mon Sep 17 00:00:00 2001 From: Dardan Rrafshi Date: Thu, 14 Mar 2024 23:19:46 +0100 Subject: [PATCH 1/2] Merged workflow files --- .github/workflows/ci-build.yml | 96 ++++++++++++++++++++++++++++++++ .github/workflows/ci-deploy.yml | 10 ++-- .github/workflows/ci-release.yml | 10 ++-- 3 files changed, 106 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 525e239..f196adc 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -114,3 +114,99 @@ jobs: if: ${{ matrix.node_version == '20.x' }} env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + + release: + name: Release Application + runs-on: ubuntu-latest + timeout-minutes: 30 + + needs: [code_quality, build, test] + + steps: + - name: Checkout Repository ${{ github.event.repository.name }} + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Retrieve Latest Release + uses: actions/github-script@v7 + id: retrieve_latest_release + with: + script: | + const scriptPath = '${{ github.workspace }}/.github/scripts/retrieve-latest-release.js'; + const { default: retrieveLatestRelease } = await import(scriptPath); + await retrieveLatestRelease({ core, context, github }); + + - name: Upload Release Asset + uses: actions/github-script@v7 + id: upload_release_asset + with: + script: | + const scriptPath = '${{ github.workspace }}/.github/scripts/upload-release-asset.js'; + const release = ${{ steps.retrieve_latest_release.outputs.release }}; + const { default: uploadReleaseAsset } = await import(scriptPath); + await uploadReleaseAsset({ core, context, github, release }); + + - name: Publish Latest Release + uses: actions/github-script@v7 + id: publish_latest_release + with: + script: | + const scriptPath = '${{ github.workspace }}/.github/scripts/publish-latest-release.js'; + const release = ${{ steps.retrieve_latest_release.outputs.release }}; + const { default: publishLatestRelease } = await import(scriptPath); + await publishLatestRelease({ core, context, github, release }); + + deploy: + name: Deploy Application + runs-on: ubuntu-latest + timeout-minutes: 30 + + needs: [release] + + env: + node_version: 20.x + netlify_version: 17.13.2 + + environment: + name: netlify + url: ${{ steps.deploy_app.outputs.deployInfo.environmentUrl }} + + steps: + - name: Checkout Repository ${{ github.event.repository.name }} + uses: actions/checkout@v4 + + - name: Setup Node Version ${{ env.node_version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ env.node_version }} + cache: "npm" + + - name: Setup Netlify Version ${{ env.netlify_version }} + run: | + npm install -g netlify-cli@${{ env.netlify_version }} + npm install decompress + + - name: Download Release Asset + uses: actions/github-script@v7 + id: download_release_asset + with: + script: | + const scriptPath = '${{ github.workspace }}/.github/scripts/download-release-asset.cjs'; + const { default: downloadReleaseAsset } = await import(scriptPath); + await downloadReleaseAsset({ core, context, github }); + + - name: Deploy Application + uses: actions/github-script@v7 + id: deploy_app + with: + script: | + const scriptPath = '${{ github.workspace }}/.github/scripts/deploy-app-netlify.js'; + const { default: deployApp } = await import(scriptPath); + + const netlify = { + site: '${{ secrets.NETLIFY_SITE }}', + token: '${{ secrets.NETLIFY_TOKEN }}' + }; + + await deployApp({ core, exec, netlify }); diff --git a/.github/workflows/ci-deploy.yml b/.github/workflows/ci-deploy.yml index c8f65e3..977fc04 100644 --- a/.github/workflows/ci-deploy.yml +++ b/.github/workflows/ci-deploy.yml @@ -1,10 +1,10 @@ name: Netlify CI Deploy -on: - workflow_run: - workflows: ["GitHub CI Release"] - types: ["completed"] - branches: ["main", "dev", "feature**"] +# on: +# workflow_run: +# workflows: ["GitHub CI Release"] +# types: ["completed"] +# branches: ["main", "dev", "feature**"] jobs: deploy: diff --git a/.github/workflows/ci-release.yml b/.github/workflows/ci-release.yml index 38c2dfa..337b055 100644 --- a/.github/workflows/ci-release.yml +++ b/.github/workflows/ci-release.yml @@ -1,10 +1,10 @@ name: GitHub CI Release -on: - workflow_run: - workflows: ["Node CI Build"] - types: ["completed"] - branches: ["main", "dev", "feature**"] +# on: +# workflow_run: +# workflows: ["Node CI Build"] +# types: ["completed"] +# branches: ["main", "dev", "feature**"] jobs: release: From b184e6dc74aee91afaa583f75ad90326becc903f Mon Sep 17 00:00:00 2001 From: Dardan Rrafshi Date: Thu, 14 Mar 2024 23:27:20 +0100 Subject: [PATCH 2/2] Deleted other workflows --- .github/workflows/ci-deploy.yml | 60 -------------------------------- .github/workflows/ci-release.yml | 48 ------------------------- 2 files changed, 108 deletions(-) delete mode 100644 .github/workflows/ci-deploy.yml delete mode 100644 .github/workflows/ci-release.yml diff --git a/.github/workflows/ci-deploy.yml b/.github/workflows/ci-deploy.yml deleted file mode 100644 index 977fc04..0000000 --- a/.github/workflows/ci-deploy.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: Netlify CI Deploy - -# on: -# workflow_run: -# workflows: ["GitHub CI Release"] -# types: ["completed"] -# branches: ["main", "dev", "feature**"] - -jobs: - deploy: - name: Deploy Application - runs-on: ubuntu-latest - timeout-minutes: 30 - - env: - node_version: 20.x - netlify_version: 17.13.2 - - environment: - name: netlify - url: ${{ steps.deploy_app.outputs.deployInfo.environmentUrl }} - - steps: - - name: Checkout Repository ${{ github.event.repository.name }} - uses: actions/checkout@v4 - - - name: Setup Node Version ${{ env.node_version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ env.node_version }} - cache: "npm" - - - name: Setup Netlify Version ${{ env.netlify_version }} - run: | - npm install -g netlify-cli@${{ env.netlify_version }} - npm install decompress - - - name: Download Release Asset - uses: actions/github-script@v7 - id: download_release_asset - with: - script: | - const scriptPath = '${{ github.workspace }}/.github/scripts/download-release-asset.cjs'; - const { default: downloadReleaseAsset } = await import(scriptPath); - await downloadReleaseAsset({ core, context, github }); - - - name: Deploy Application - uses: actions/github-script@v7 - id: deploy_app - with: - script: | - const scriptPath = '${{ github.workspace }}/.github/scripts/deploy-app-netlify.js'; - const { default: deployApp } = await import(scriptPath); - - const netlify = { - site: '${{ secrets.NETLIFY_SITE }}', - token: '${{ secrets.NETLIFY_TOKEN }}' - }; - - await deployApp({ core, exec, netlify }); diff --git a/.github/workflows/ci-release.yml b/.github/workflows/ci-release.yml deleted file mode 100644 index 337b055..0000000 --- a/.github/workflows/ci-release.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: GitHub CI Release - -# on: -# workflow_run: -# workflows: ["Node CI Build"] -# types: ["completed"] -# branches: ["main", "dev", "feature**"] - -jobs: - release: - name: Release Application - runs-on: ubuntu-latest - timeout-minutes: 30 - - steps: - - name: Checkout Repository ${{ github.event.repository.name }} - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Retrieve Latest Release - uses: actions/github-script@v7 - id: retrieve_latest_release - with: - script: | - const scriptPath = '${{ github.workspace }}/.github/scripts/retrieve-latest-release.js'; - const { default: retrieveLatestRelease } = await import(scriptPath); - await retrieveLatestRelease({ core, context, github }); - - - name: Upload Release Asset - uses: actions/github-script@v7 - id: upload_release_asset - with: - script: | - const scriptPath = '${{ github.workspace }}/.github/scripts/upload-release-asset.js'; - const release = ${{ steps.retrieve_latest_release.outputs.release }}; - const { default: uploadReleaseAsset } = await import(scriptPath); - await uploadReleaseAsset({ core, context, github, release }); - - - name: Publish Latest Release - uses: actions/github-script@v7 - id: publish_latest_release - with: - script: | - const scriptPath = '${{ github.workspace }}/.github/scripts/publish-latest-release.js'; - const release = ${{ steps.retrieve_latest_release.outputs.release }}; - const { default: publishLatestRelease } = await import(scriptPath); - await publishLatestRelease({ core, context, github, release });