Fixed: version format in deploy_alpha.yml #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'deploy_alpha' | |
on: | |
push: | |
branches: | |
- 188-deploy-latest-develop-version | |
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 | |
contents: read | |
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 | |
run: | | |
# Fetch or initialize the version counter | |
if [ ! -f .alpha_version ]; then | |
echo "1" > .alpha_version | |
fi | |
INCREMENTAL_NUMBER=$(cat .alpha_version) | |
# Increment version number | |
NEW_INCREMENTAL_NUMBER=$((INCREMENTAL_NUMBER+1)) | |
# Save the new incremental number to the file | |
echo "${NEW_INCREMENTAL_NUMBER}" > .alpha_version | |
# Update package version with 2.0.0.alpha.<incremental_number> | |
NEW_VERSION="2.0.0-test.${INCREMENTAL_NUMBER}" | |
npm version "${NEW_VERSION}" --no-git-tag-version | |
# Commit the version update and incremental number | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "GitHub Actions" | |
git add package.json .alpha_version | |
git commit -m "Update version to ${NEW_VERSION}" | |
- name: Publish package | |
run: | | |
echo "$(jq '.publishConfig.registry = "https://npm.pkg.github.com"' package.json)" > package.json | |
echo "$( jq '.name = "@IQSS/dataverse-client-javascript"' package.json )" > package.json | |
npm publish --@IQSS:registry=https://npm.pkg.github.com | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |