diff --git a/.github/workflows/example-builds-nightly.yml b/.github/workflows/example-builds-nightly.yml index db50c37..17e4b34 100644 --- a/.github/workflows/example-builds-nightly.yml +++ b/.github/workflows/example-builds-nightly.yml @@ -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: ./ diff --git a/.github/workflows/example-builds.yml b/.github/workflows/example-builds.yml index 7c399fa..d4fdad7 100644 --- a/.github/workflows/example-builds.yml +++ b/.github/workflows/example-builds.yml @@ -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: ./ diff --git a/.gitignore b/.gitignore index 692e74b..bb7cf0b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules/ __tests__/runner/* +dist/ diff --git a/action.yml b/action.yml index d50fe74..2238557 100644 --- a/action.yml +++ b/action.yml @@ -15,7 +15,7 @@ inputs: default: 'false' runs: using: 'node12' - main: 'lib/setup-julia.js' + main: 'dist/index.js' branding: icon: 'download' color: 'green' diff --git a/bin/build-release b/bin/build-release index 43dc24f..f581f2f 100644 --- a/bin/build-release +++ b/bin/build-release @@ -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" diff --git a/bin/build-test-release b/bin/build-test-release index 8f2b3ac..efd3561 100644 --- a/bin/build-test-release +++ b/bin/build-test-release @@ -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" diff --git a/package-lock.json b/package-lock.json index 4d0d6ec..bb26c35 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index bc38674..e7f4a3d 100644 --- a/package.json +++ b/package.json @@ -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",