Use @zeit/ncc to distribute action

This commit is contained in:
Sascha Mann
2020-03-24 18:18:30 +01:00
parent e07eb0ff2a
commit b440227ef4
8 changed files with 81 additions and 15 deletions

View File

@@ -23,7 +23,10 @@ jobs:
- uses: actions/checkout@v1.0.0
- name: "Install dependencies"
run: npm install --production
run: |
npm install
npm run build
npm run pack
- name: "Set up Julia (nightly)"
uses: ./

View File

@@ -20,7 +20,10 @@ jobs:
- uses: actions/checkout@v1.0.0
- name: "Install dependencies"
run: npm install --production
run: |
npm install
npm run build
npm run pack
- name: "Set up Julia"
uses: ./

1
.gitignore vendored
View File

@@ -1,2 +1,3 @@
node_modules/
__tests__/runner/*
dist/

View File

@@ -15,7 +15,7 @@ inputs:
default: 'false'
runs:
using: 'node12'
main: 'lib/setup-julia.js'
main: 'dist/index.js'
branding:
icon: 'download'
color: 'green'

View File

@@ -1,13 +1,44 @@
#!/bin/sh
git checkout -b releases/"$1"
branch_name="$(git symbolic-ref --short -q HEAD)"
version="v$(jq -r .version package.json)"
repo="$1"
if [ -z "$repo" ]; then
echo "ERROR: must specify repository"
exit 1
fi
echo "=== debug info ==="
echo "branch: $branch_name"
echo "version: $version"
echo "repo: $repo"
echo "=================="
echo ""
# Check that the version doesn't exist yet
version_exists="$(curl -s https://api.github.com/repos/"$repo"/tags -H "Accept: application/vnd.github.v3.full+json" | jq -r '.[] | select(.name == "'"$version"'") | .name')"
if [ -n "$version_exists" ]; then
echo "ERROR: version $version already exists"
exit 1
fi
git checkout -b releases/"$version"
npm install
npm run build
npm test
npm prune --production
npm run pack
sed -i 's/node_modules/!node_modules/g' .gitignore
git add node_modules
sed -i 's/dist/!dist/g' .gitignore
git add dist
git commit -a -m "Add production dependencies & build"
git tag "$1"
# Tags
major_minor="$(sed 's/\.[^.]*$//' <<< "$version")"
major="$(sed 's/\.[^.]*$//' <<< "$major_minor")"
git tag "$version"
git tag -f "$major_minor"
git tag -f "$major"
git tag -f "latest"

View File

@@ -1,14 +1,36 @@
#!/bin/sh
branch_name="$(git symbolic-ref --short -q HEAD)"
version="v$(jq -r .version package.json)"
repo="$1"
git checkout -B test/"$branch_name"
if [ -z "$repo" ]; then
echo "ERROR: must specify repository"
exit 1
fi
echo "=== debug info ==="
echo "branch: $branch_name"
echo "version: $version"
echo "repo: $repo"
echo "=================="
echo ""
# Check that the version doesn't exist yet
version_exists="$(curl -s https://api.github.com/repos/"$repo"/tags -H "Accept: application/vnd.github.v3.full+json" | jq -r '.[] | select(.name == "'"$version"'") | .name')"
if [ -n "$version_exists" ]; then
echo "ERROR: version $version already exists"
exit 1
fi
git checkout -B test/"$branch_name"/releases/"$version"
npm install
npm run build
npm test
npm prune --production
npm run pack
sed -i 's/node_modules/!node_modules/g' .gitignore
git add node_modules
# Add dist/ to git and commit it
sed -i 's/dist/!dist/g' .gitignore
git add dist
git commit -a -m "Add production dependencies & build"

6
package-lock.json generated
View File

@@ -1495,6 +1495,12 @@
"integrity": "sha512-FA/BWv8t8ZWJ+gEOnLLd8ygxH/2UFbAvgEonyfN6yWGLKc7zVjbpl2Y4CTjid9h2RfgPP6SEt6uHwEOply00yw==",
"dev": true
},
"@zeit/ncc": {
"version": "0.22.0",
"resolved": "https://registry.npmjs.org/@zeit/ncc/-/ncc-0.22.0.tgz",
"integrity": "sha512-zaS6chwztGSLSEzsTJw9sLTYxQt57bPFBtsYlVtbqGvmDUsfW7xgXPYofzFa1kB9ur2dRop6IxCwPnWLBVCrbQ==",
"dev": true
},
"abab": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/abab/-/abab-2.0.3.tgz",

View File

@@ -1,13 +1,12 @@
{
"name": "setup-julia",
"version": "0.1.0",
"version": "1.1.3",
"private": true,
"description": "setup Julia action",
"main": "lib/setup-julia.js",
"scripts": {
"build": "tsc",
"format": "prettier --single-quote --print-width 120 --tab-width 4 --no-semi --write **/*.ts",
"format-check": "prettier --single-quote --print-width 120 --tab-width 4 --no-semi --check **/*.ts",
"pack": "ncc build",
"test": "jest"
},
"repository": {
@@ -32,6 +31,7 @@
"@types/jest": "^24.0.13",
"@types/node": "^12.12.7",
"@types/semver": "^6.0.0",
"@zeit/ncc": "^0.22.0",
"jest": "^24.8.0",
"jest-circus": "^24.7.1",
"prettier": "^1.17.1",