From 54119995468752195dc20bba31cd6f0c08a622f2 Mon Sep 17 00:00:00 2001 From: hoseacodes Date: Mon, 27 May 2024 12:53:44 -0500 Subject: [PATCH] fix(*): update master pipeline --- .github/workflows/master.yaml | 90 ++++++++++++++++++++++++++++++++++- 1 file changed, 89 insertions(+), 1 deletion(-) diff --git a/.github/workflows/master.yaml b/.github/workflows/master.yaml index b7e4c5ca..7d53f72b 100644 --- a/.github/workflows/master.yaml +++ b/.github/workflows/master.yaml @@ -14,4 +14,92 @@ jobs: env: SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} with: - command: monitor \ No newline at end of file + command: monitor + build: + needs: [security] + runs-on: ubuntu-latest + outputs: + build_path: ${{ steps.archive_build.outputs.build_path }} + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: '20' + - name: Install Dependencies + run: npm install --legacy-peer-deps + - name: Build project + run: | + export SKIP_PREFLIGHT_CHECK=true + npm run build + - name: Archive build output + id: archive_build + run: | + tar -czf build.tar.gz build/ + echo "::set-output name=build_path::build.tar.gz" + - name: Create conventional changelog action + id: changelog + uses: TriPSs/conventional-changelog-action@latest + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + tag-prefix: "dev.v" + git-push: false + - name: Create GitHub Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.changelog.outputs.tag }} + release_name: Release ${{ steps.changelog.outputs.tag }} + body: ${{steps.changelog.outputs.clean_changelog}} + draft: false + prerelease: false + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: build.tar.gz + asset_name: build.tar.gz + asset_content_type: application/gzip + - name: Deploy to Heroku + uses: akhileshns/heroku-deploy@v3.12.12 + with: + heroku_api_key: ${{ secrets.HEROKU_API_KEY }} + heroku_app_name: hoseacodes-dev + heroku_email: "dominique11h@yahoo.com" + release: + needs: [build] + name: Release pushed tag + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 # required for github-action-get-previous-tag + - name: Get previous tag + id: previoustag + uses: 'WyriHaximus/github-action-get-previous-tag@v1' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Get next minor version + id: semver + uses: 'WyriHaximus/github-action-next-semvers@v1' + with: + version: ${{ steps.previoustag.outputs.tag }} + - name: Create release + id: create_release_id + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ github.ref_name }} + run: | + gh release create "$tag ${{ steps.semver.outputs.patch }}" \ + --repo="$GITHUB_REPOSITORY" \ + --title="${GITHUB_REPOSITORY#*/} ${tag#v}" \ + --generate-notes + with: + tag_name: ${{ steps.semver.outputs.patch }} + release_name: Release ${{ steps.semver.outputs.patch }} \ No newline at end of file