Skip to content

Commit

Permalink
feat(ci/build-release): automatically build release on tag push
Browse files Browse the repository at this point in the history
  • Loading branch information
TasoOneAsia committed Aug 6, 2021
1 parent f7a3708 commit b24458a
Showing 1 changed file with 20 additions and 24 deletions.
44 changes: 20 additions & 24 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Production build
name: Create Tagged Release

on:
push:
Expand All @@ -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

0 comments on commit b24458a

Please sign in to comment.