diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 50552119..50f6f5ec 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,38 +1,70 @@ -on: - push: - # Sequence of patterns matched against refs/tags - tags: - - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 +# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions -name: Upload Release Asset +name: Build and Release master branch +on: + workflow_dispatch: + jobs: - build: - name: Upload Release Asset + test: + if: ${{ false }} # disable for now runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [14.x, 16.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + steps: - - name: Checkout code + - name: Checkout + uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm ci + - run: npm run test --if-present + + release: + runs-on: ubuntu-latest + #needs: test + steps: + - name: Checkout uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - name: Get JSON Version + id: version + uses: notiz-dev/github-action-json-property@release + with: + path: 'module.json' + prop_path: 'version' + - name: Prepare Module Manifest + id: sub_manifest_link_version + uses: microsoft/variable-substitution@v1 + with: + files: 'module.json' + env: + version: ${{steps.version.outputs.prop}} + manifest: https://raw.githubusercontent.com/${{github.repository}}/master/module.json + download: https://github.com/${{github.repository}}/releases/latest/download/better-rolltables.zip + - run: npm ci && npm run build --if-present - name: Zip files run: | - zip -r better-rolltables * -x "img/*" ".github/*" ".idea/*" "tsconfig.json" - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref }} + cd dist + zip -r ../better-rolltables . + - uses: ncipollo/release-action@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + allowUpdates: true + tag: v${{steps.version.outputs.prop}} + name: v${{steps.version.outputs.prop}} + artifacts: 'better-rolltables.zip' draft: false prerelease: false - - name: Upload Release Asset - id: upload-release-asset - uses: actions/upload-release-asset@v1.0.2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./better-rolltables.zip - asset_name: better-rolltables.zip - asset_content_type: application/zip + generateReleaseNotes: true