Skip to content

Commit f233f60

Browse files
committed
Only pack the package once
1 parent e44195d commit f233f60

File tree

2 files changed

+37
-11
lines changed

2 files changed

+37
-11
lines changed

.github/workflows/push.yml

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ jobs:
1919
- run: npm ci
2020
- run: npm run lint
2121
- run: npm run test:examples
22+
- run: npm pack
23+
- uses: actions/upload-artifact@v3
24+
with:
25+
if-no-files-found: error
26+
name: package
27+
path: codeyourfuture-eslint-config-standard-*.tgz
2228
install:
2329
runs-on: ubuntu-22.04
2430
needs: build
@@ -32,11 +38,31 @@ jobs:
3238
with:
3339
cache: 'npm'
3440
node-version: ${{ matrix.node }}
41+
- uses: actions/download-artifact@v3
42+
with:
43+
name: package
3544
- run: npm ci
3645
- run: npm run test:install
3746
env:
3847
ESLINT_VERSION: ${{ matrix.eslint }}
39-
deploy:
48+
PACK: 'false'
49+
deploy-github:
50+
runs-on: ubuntu-22.04
51+
if: startsWith(github.ref, 'refs/tags/v')
52+
needs: install
53+
steps:
54+
- uses: actions/checkout@v3
55+
- uses: actions/download-artifact@v3
56+
with:
57+
name: package
58+
- run: |
59+
gh release create \
60+
'${{ github.ref_name }}' \
61+
--title '${{ github.ref_name }}' \
62+
codeyourfuture-eslint-config-standard-*.tgz
63+
env:
64+
GH_TOKEN: ${{ github.token }}
65+
deploy-npm:
4066
runs-on: ubuntu-22.04
4167
if: startsWith(github.ref, 'refs/tags/v')
4268
needs: install
@@ -48,12 +74,7 @@ jobs:
4874
- run: npm config set '//registry.npmjs.org/:_authToken' "${NPM_AUTH_TOKEN}"
4975
env:
5076
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
51-
- run: npm pack
77+
- uses: actions/download-artifact@v3
78+
with:
79+
name: package
5280
- run: npm publish codeyourfuture-eslint-config-standard-*.tgz
53-
- run: |
54-
gh release create \
55-
'${{ github.ref_name }}' \
56-
--title '${{ github.ref_name }}' \
57-
codeyourfuture-eslint-config-standard-*.tgz
58-
env:
59-
GH_TOKEN: ${{ github.token }}

bin/test.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@ set -euo pipefail
55
# Initial setup
66
echo "Testing with ESLint v$ESLINT_VERSION"
77
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8+
PACK="${PACK:-}"
89
ROOT_DIR="$HERE/.."
910
TEST_DIR="$ROOT_DIR/test"
1011
rm -rf "$TEST_DIR"
1112

1213
# Get current package version and create tarball to install from
1314
pushd "$ROOT_DIR"
1415
PACKAGE_VERSION=$(node -p 'require("./package.json").version')
15-
npm pack
16+
if [[ ! "$PACK" = 'false' ]]; then
17+
npm pack
18+
fi
1619
popd
1720

1821
# Create a basic test package with no warnings
@@ -52,4 +55,6 @@ popd
5255

5356
# Tidy up
5457
rm -rf "$TEST_DIR"
55-
rm -f "$ROOT_DIR/codeyourfuture-eslint-config-standard-$PACKAGE_VERSION.tgz"
58+
if [[ ! "$PACK" = 'false' ]] then
59+
rm -f "$ROOT_DIR/codeyourfuture-eslint-config-standard-$PACKAGE_VERSION.tgz"
60+
fi

0 commit comments

Comments
 (0)