diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..b796ef2 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,72 @@ +name: CI (Release) + +on: + push: + tags: + - "v*" + +jobs: + test-again: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-latest + - macos-latest + - windows-latest + steps: + - name: Set git to use LF + run: | + git config --global core.autocrlf false + git config --global core.eol lf + if: runner.os == 'Windows' + - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Install dependencies + run: yarn install + - name: Build package + run: yarn build + - name: Run tests + run: yarn test + release: + runs-on: ubuntu-latest + needs: + - test-again + steps: + - uses: actions/checkout@v2 + - name: Use Node.js And Setup .npmrc + uses: actions/setup-node@v1 + with: + node-version: "14" + registry-url: "https://registry.npmjs.org" + - name: Create a Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + # The name of the tag. This should come from the webhook payload, `github.GITHUB_REF` when a user pushes a new tag + tag_name: ${{ github.ref }} + # The name of the release. For example, `Release v1.0.1` + release_name: Release ${{ github.ref }} + - name: Get the version + id: get_version + run: | + echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/} + echo ::set-output name=DEB_NAME::$(basename $(ls ${{ runner.temp }}/deb-package/*.deb | tail -n 1)) + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + - uses: actions/cache@v2 + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + - name: Publish module + run: yarn publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + id: publish