diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..8d317a6 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,32 @@ +name: Release + +on: + push: + tags: + - v* + +jobs: + checks: + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/v') + steps: + - name: Check out source code + uses: actions/checkout@v4 + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: '18.x' + - name: Install dependencies + run: npm install + - name: Build & archive + run: | + set -x + VERSION="${GITHUB_REF##*/}" + npm run webpack && tar -zcf "k6-jslib-aws-${VERSION}.tar.gz" -C build . + - name: Create release with assets + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + set -x + VERSION="${GITHUB_REF##*/}" + gh release create "${VERSION}" "k6-jslib-aws-${VERSION}.tar.gz" "build/*" --target "${GITHUB_SHA}" --title "${VERSION}" \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 624212c..bca7102 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -52,20 +52,18 @@ In a PR: 1. Bump the version in the `package.json` file. 2. Run the `npm update` command to update the `package-lock.json` file. 3. Run the `npm run webpack` command to ensure the build system produces the latest distributable files. -4. Search and replace every occurences of the previous version in the `README.md` file with the new version. -5. Search and replace every occurences of the previous version in the `/examples` directory with the new version. +4. Search and replace every occurrence of the previous version in the `README.md` file with the new version. +5. Search and replace every occurrence of the previous version in the `/examples` directory with the new version. ### Create a tag and GitHub version 1. Tag the latest main branch's commit with the new version, following the [semantic versioning](https://semver.org/) convention, prefixed with a `v` character, as in: `v0.7.1`. -2. Create a dedicated GitHub version: - 1. Pointing to the tag created above - 2. Using the same name as the tag created above - 3. Including the build files included in the commit tagged above +2. The [release.yml](.github/workflows/release.yml) workflow will automatically create a GitHub release with the new version. ### Publishing the new version -1. Open a PR on the [jslib repository](https://github.com/grafana/jslib.k6.io) using the `build/` directory files following the [new version instructions](https://github.com/grafana/jslib.k6.io#updating-a-version-of-a-js-package-listed-in-packagejson-dependencies). +1. Open a PR on the [jslib repository](https://github.com/grafana/jslib.k6.io) using the files from the [latest release](https://github.com/grafana/k6-jslib-aws/releases), +and following the [new version instructions](https://github.com/grafana/jslib.k6.io#updating-a-version-of-a-js-package-listed-in-packagejson-dependencies). 2. Make sure the k6 documentation website is updated to include the new version of the library: 1. The documented API should reflect the new version. 2. All the links to the library should point to the new version.