diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 94a9ff2..93e49ae 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,10 +32,17 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Update version in package.json + run: | + # Read the latest release version from environment variable + LATEST_VERSION="${{ env.LATEST_RELEASE }}" + + # Update the "version" field in package.json using jq + jq --arg version "$LATEST_VERSION" '.version = $version' package.json > temp.json && mv temp.json package.json - name: Setup node uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 20 - name: Inject access token in .npmrc run: | echo "registry=https://npm.pkg.github.com/helsingborg-stad" >> ~/.npmrc @@ -43,15 +50,13 @@ jobs: - name: Run CI if: ${{ hashFiles('package.json') != '' && hashFiles('package-lock.json') != '' }} run: npm ci --no-progress --no-audit - - name: Run install - if: ${{ hashFiles('package.json') != '' && hashFiles('package-lock.json') == '' }} - run: npm install --no-progress --no-audit - name: Run build if: ${{ hashFiles('package-lock.json') != '' && hashFiles('gulp.js') == '' }} run: npx --yes browserslist@latest --update-db && npm run build - - name: Run gulp - if: ${{ hashFiles('package-lock.json') != '' && hashFiles('gulp.js') != '' }} - run: gulp + - name: Publish npm package to GHCR + run: npm publish --registry=https://npm.pkg.github.com + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Create assets zip uses: thedoctor0/zip-release@0.7.5 if: ${{ hashFiles('dist/') != '' }} diff --git a/.gitignore b/.gitignore index 8f61d33..c74c2cc 100644 --- a/.gitignore +++ b/.gitignore @@ -53,7 +53,8 @@ Thumbs.db # track these files, if they exist !.gitignore !.editorconfig +!.github # ignore dist folder dist/ -dist +dist \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 314feef..f671804 100644 --- a/package-lock.json +++ b/package-lock.json @@ -695,9 +695,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001589", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001589.tgz", - "integrity": "sha512-vNQWS6kI+q6sBlHbh71IIeC+sRwK2N3EDySc/updIGhIee2x5z00J4c1242/5/d6EpEMdOnk/m+6tuk4/tcsqg==", + "version": "1.0.30001660", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001660.tgz", + "integrity": "sha512-GacvNTTuATm26qC74pt+ad1fW15mlQ/zuTzzY1ZoIzECTP8HURDfF43kNxPgf7H1jmelCBQTTbBNxdSXOA7Bqg==", "dev": true, "funding": [ { diff --git a/package.json b/package.json index f801011..13f7c0b 100755 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "modularity-timeline", + "name": "@helsingborg-stad/modularity-timeline", "version": "4.0.1", "description": "An addon for displaying timeline.", "main": "", @@ -23,14 +23,15 @@ "> 1%", "not dead" ], + "files": ["dist/"], "devDependencies": { "autoprefixer": "^10.4.2", "clean-webpack-plugin": "^4.0.0", "cross-env": "^7.0.3", "css-loader": "^6.6.0", + "css-minimizer-webpack-plugin": "^3.4.1", "import-glob-loader": "^1.1.0", "mini-css-extract-plugin": "^2.5.3", - "css-minimizer-webpack-plugin": "^3.4.1", "postcss-loader": "^6.2.1", "sass": "^1.49.7", "sass-loader": "^12.4.0", @@ -38,9 +39,9 @@ "webpack-bundle-analyzer": "^4.5.0", "webpack-cli": "^4.9.2", "webpack-config-utils": "^2.3.1", - "webpack-remove-empty-scripts": "^0.7.3", "webpack-manifest-plugin": "^4.1.1", - "webpack-notifier": "^1.15.0" + "webpack-notifier": "^1.15.0", + "webpack-remove-empty-scripts": "^0.7.3" }, "browser": { "child_process": false @@ -54,4 +55,4 @@ "@babel/plugin-proposal-class-properties" ] } -} \ No newline at end of file +}