mirror of
https://github.com/Neur0toxine/yt-normal-thumbnails.git
synced 2024-11-28 15:56:07 +03:00
69 lines
2.2 KiB
YAML
69 lines
2.2 KiB
YAML
name: ci
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
node-version: [12.x, 14.x]
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
- run: npm install
|
|
- run: npm run build
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: index.js
|
|
path: index.js
|
|
deploy:
|
|
needs: ['build']
|
|
if: success() && github.event_name == 'push' && github.repository_owner == 'Neur0toxine' && github.ref == 'refs/heads/master'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Unshallow repository and determine previous version
|
|
run: |
|
|
git fetch origin --unshallow --tags
|
|
export PREVIOUS_VERSION=`git describe --abbrev=0 --tags || true`
|
|
echo PREVIOUS_VERSION=$PREVIOUS_VERSION >> $GITHUB_ENV
|
|
echo Previous version is $PREVIOUS_VERSION
|
|
- uses: actions/download-artifact@v2
|
|
with:
|
|
name: index.js
|
|
- name: Determine new version
|
|
run: |
|
|
export CURRENT_VERSION=`cat index.js | grep '@version' | awk '{print $3;}'`
|
|
echo CURRENT_VERSION=$CURRENT_VERSION >> $GITHUB_ENV
|
|
echo Current version is $CURRENT_VERSION
|
|
- name: Create Release
|
|
id: create_release
|
|
uses: actions/create-release@v1
|
|
if: env.PREVIOUS_VERSION != env.CURRENT_VERSION
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: ${{ env.CURRENT_VERSION }}
|
|
release_name: ${{ env.CURRENT_VERSION }}
|
|
body: ''
|
|
draft: false
|
|
prerelease: false
|
|
- name: Upload Release Asset
|
|
id: upload-release-asset
|
|
if: env.PREVIOUS_VERSION != env.CURRENT_VERSION
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: index.js
|
|
asset_name: index.js
|
|
asset_content_type: text/javascript
|