Skip to content

Merge pull request #435 from IQSS/434-format-option-for-download-usec… #112

Merge pull request #435 from IQSS/434-format-option-for-download-usec…

Merge pull request #435 from IQSS/434-format-option-for-download-usec… #112

Workflow file for this run

name: 'deploy_alpha'
on:
push:
branches:
- develop
jobs:
test-unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 19
- name: Install npm dependencies
run: npm ci
- name: Run unit tests
run: npm run test:unit
test-integration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 19
- name: Install npm dependencies
run: npm ci
- name: Run integration tests
run: npm run test:integration
test-functional:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 19
- name: Install npm dependencies
run: npm ci
- name: Run functional tests
run: npm run test:functional
publish-gpr:
needs: [test-unit, test-integration, test-functional]
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 19
registry-url: https://npm.pkg.github.com/
- name: Install npm dependencies
run: npm ci
- name: Build package
run: npm run build
- name: Update package version
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc
CURRENT_PACKAGE_VERSION=$(jq -r '.version' package.json)
BASE_VERSION=${CURRENT_PACKAGE_VERSION%%-alpha.*}
LATEST_VERSION=$(npm show @iqss/dataverse-client-javascript versions --registry=https://npm.pkg.github.com/ --json | jq -r '.[]' | grep "^${BASE_VERSION}-alpha\\." | sort -V | tail -n 1)
if [ -z "$LATEST_VERSION" ]; then
NEW_INCREMENTAL_NUMBER=1
else
CURRENT_INCREMENTAL_NUMBER=$(echo "$LATEST_VERSION" | sed "s/^${BASE_VERSION}-alpha\\.//")
NEW_INCREMENTAL_NUMBER=$((CURRENT_INCREMENTAL_NUMBER + 1))
fi
NEW_VERSION="${BASE_VERSION}-alpha.${NEW_INCREMENTAL_NUMBER}"
echo "Latest version: $LATEST_VERSION"
echo "New version: $NEW_VERSION"
echo "Setting package version to: ${NEW_VERSION}"
npm version "${NEW_VERSION}" --no-git-tag-version
- name: Publish package
run: |
echo "$(jq '.publishConfig.registry = "https://npm.pkg.github.com"' package.json)" > package.json
npm publish --@iqss:registry=https://npm.pkg.github.com
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}