name: ci on: [push, pull_request] env: project: 'release-node' jobs: test: strategy: matrix: node-version: [12.x, 14.x] os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} steps: - name: Checkout uses: actions/checkout@v2 # verify the version in package.json matches the release tag - name: Version uses: tcurdt/action-verify-version-npm@master - name: Setup Node ${{ matrix.node-version }} uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} - name: Cache id: cache-modules uses: actions/cache@v2 with: path: node_modules key: ${{ matrix.node-version }}-${{ runner.OS }}-build-${{ hashFiles('package.json') }} - name: Install if: steps.cache-modules.outputs.cache-hit != 'true' run: npm install - name: Test run: npm test # create release artifacts to publish as github release # - name: Upload # if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') # uses: actions/upload-artifact@v2 # with: # name: ${{ env.project }}_${{ matrix.os }}_${{ matrix.node-version }} # path: | # !.git # !.github # !node_modules # . release: if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') needs: [test] runs-on: ubuntu-latest steps: # - name: Download # uses: actions/download-artifact@v2 # with: # path: artifacts # - name: Archives # run: find artifacts -mindepth 1 -maxdepth 1 -exec tar -C {} -cvzf {}.tgz . \; - name: Release uses: softprops/action-gh-release@v1 # with: # files: | # artifacts/*.tgz env: GITHUB_TOKEN: ${{ secrets.PAT }}