You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
85 lines
2.5 KiB
85 lines
2.5 KiB
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
|
|
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
|
|
|
|
name: SamWafWeb CI
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
matrix:
|
|
node-version: [18.20.4]
|
|
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
cache: 'npm'
|
|
- run: npm ci
|
|
- run: npm run build --if-present
|
|
- run: npm test
|
|
- name: Get version from package.json
|
|
id: get_version
|
|
run: |
|
|
VERSION=$(node -p "require('./package.json').version")
|
|
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
|
|
|
- name: Create .zip package
|
|
run: |
|
|
zip -r dist.zip dist
|
|
|
|
- name: Create .tar.gz package
|
|
run: |
|
|
tar -czvf dist.tar.gz dist
|
|
|
|
- name: Upload artifacts dist.zip
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: dist.zip
|
|
path: |
|
|
dist.zip
|
|
- name: Upload artifacts dist.tar.gz
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: dist.tar.gz
|
|
path: |
|
|
dist.tar.gz
|
|
- name: Create GitHub Release
|
|
id: create_release
|
|
uses: actions/create-release@v1.1.4
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: v${{ env.VERSION }}
|
|
release_name: v${{ env.VERSION }}
|
|
draft: false
|
|
prerelease: false
|
|
- name: Upload Release Assets dist.zip
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: dist.zip
|
|
asset_name: dist.zip
|
|
asset_content_type: application/octet-stream
|
|
- name: Upload Release Assets dist.tar.gz
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: dist.tar.gz
|
|
asset_name: dist.tar.gz
|
|
asset_content_type: application/octet-stream
|