Skip to content

Apply 'npm pkg fix'

Apply 'npm pkg fix' #1

Workflow file for this run

name: release
on:
push:
tags:
- '*'
env:
STACK_VERSION: '2.9.1'
jobs:
draft_release:
name: Create release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: ""
draft: false
prerelease: false
commitish: master
build_release:
name: Build/upload release
needs: draft_release
runs-on: ${{ matrix.os }}
container: ${{ matrix.image }}
strategy:
matrix:
include:
- os: ubuntu-latest
image: haskell:9.2.4
- os: macOS-latest
- os: windows-latest
steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
git config --global core.longpaths true
- uses: actions/checkout@v2
- name: Setup Haskell (macOS and Windows)
if: runner.os != 'Linux'
uses: haskell/actions/setup@v1
with:
stack-version: ${{ env.STACK_VERSION }}
enable-stack: true
stack-no-global: true
- name: Check Stack version and fix root access (Linux)
if: runner.os == 'Linux'
run: |
[ "$(stack --numeric-version)" = "$STACK_VERSION" ]
chown root:root .
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: 18
# NB: We install gnu-tar because BSD tar is buggy on Github's macos machines,
# and it breaks the cache: https://github.com/actions/cache/issues/403
- name: Install GNU tar (macOS)
if: runner.os == 'macOS'
run: |
brew install gnu-tar
echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH
- name: Package binary (Linux and macOS)
if: runner.os != 'Windows'
shell: bash
run: |
./scripts/fix-home make
./scripts/fix-home stack install --dependencies-only
mkdir artifacts
./scripts/fix-home stack build --copy-bins --local-bin-path ./artifacts
cp artifacts/spago spago
strip spago
tar -zcvf "${{ runner.os }}.tar.gz" spago
- name: Package binary (Windows)
if: runner.os == 'Windows'
shell: bash
run: |
make
stack install --dependencies-only
stack build --copy-bins --local-bin-path ./artifacts
cp artifacts/spago.exe spago.exe
tar -zcvf ${{ runner.os }}.tar.gz spago.exe
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.draft_release.outputs.upload_url }}
asset_path: ./${{ runner.os }}.tar.gz
asset_name: ${{ runner.os }}.tar.gz
asset_content_type: application/gzip
- name: Package Checksum
shell: bash
run: ./scripts/checksum ${{ runner.os }}.tar.gz ${{ runner.os }}.sha1
- name: Upload Checksum Asset
id: upload-checksum-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.draft_release.outputs.upload_url }}
asset_path: ./${{ runner.os }}.sha1
asset_name: ${{ runner.os }}.sha1
asset_content_type: text/plain
npm_publish:
name: Publish package on npm
needs: build_release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 18
- name: Publish to NPM
shell: bash
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
sed -e "s/NPM_VERSION/$(./scripts/get-version)/g" -i npm/package.json
sed -e "s/PACKAGE_VERSION/$(./scripts/get-version)/g" -i npm/install.js
cd npm
cp ../README.md ./README.md
cp ../CONTRIBUTING.md ./CONTRIBUTING.md
cp ../LICENSE ./LICENSE
npm publish --non-interactive --access public