From b24458abc3a3fdf1843a98964841d52376f20115 Mon Sep 17 00:00:00 2001 From: Taso Date: Thu, 5 Aug 2021 21:32:26 -0400 Subject: [PATCH] feat(ci/build-release): automatically build release on tag push --- .github/workflows/build.yml | 44 +++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a1f6d9c43..2fc6c8e86 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Production build +name: Create Tagged Release on: push: @@ -7,43 +7,39 @@ on: jobs: build: + name: "Build Changelog & Release" runs-on: ubuntu-latest strategy: matrix: node-version: [12.x] steps: - - uses: actions/checkout@v2 - - name: 'Use Node.js ${{ matrix.node-version }}' + # We fetch to 0 so we can collect the commits + # since last update + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + ref: ${{ github.ref }} + + - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v1 with: - node-version: '${{ matrix.node-version }}' + node-version: ${{ matrix.node-version }} - name: Download all modules run: npm ci + - name: Build project run: npm run build + - name: Compress build output with zip - run: (cd ./dist; zip -r ../monitor.zip .) + run: | + cd dist && zip -r ../monitor.zip . - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Create and Upload Release + uses: "marvinpinto/action-automatic-releases@v1.2.1" with: - tag_name: ${{ github.ref }} - release_name: ${{ github.ref }} - draft: true + repo_token: ${{ secrets.GITHUB_TOKEN }} prerelease: false - - - name: Upload Release Asset - id: 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: ./monitor.zip - asset_name: monitor.zip - asset_content_type: application/zip + files: monitor.zip