Skip to content

Commit

Permalink
Stash: deploy_alpha github action WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
GPortas committed Sep 23, 2024
1 parent 29998f9 commit a12e27d
Showing 1 changed file with 100 additions and 0 deletions.
100 changes: 100 additions & 0 deletions .github/workflows/deploy_alpha.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: 'deploy_alpha'

on:
push:
branches:
- placeholder_branch

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.alpha.${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 }}

0 comments on commit a12e27d

Please sign in to comment.