Skip to content

Commit a12e27d

Browse files
committed
Stash: deploy_alpha github action WIP
1 parent 29998f9 commit a12e27d

File tree

1 file changed

+100
-0
lines changed

1 file changed

+100
-0
lines changed

.github/workflows/deploy_alpha.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: 'deploy_alpha'
2+
3+
on:
4+
push:
5+
branches:
6+
- placeholder_branch
7+
8+
jobs:
9+
test-unit:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- uses: actions/setup-node@v3
14+
with:
15+
node-version: 19
16+
17+
- name: Install npm dependencies
18+
run: npm ci
19+
20+
- name: Run unit tests
21+
run: npm run test:unit
22+
23+
test-integration:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v3
27+
- uses: actions/setup-node@v3
28+
with:
29+
node-version: 19
30+
31+
- name: Install npm dependencies
32+
run: npm ci
33+
34+
- name: Run integration tests
35+
run: npm run test:integration
36+
37+
test-functional:
38+
runs-on: ubuntu-latest
39+
steps:
40+
- uses: actions/checkout@v3
41+
- uses: actions/setup-node@v3
42+
with:
43+
node-version: 19
44+
45+
- name: Install npm dependencies
46+
run: npm ci
47+
48+
- name: Run functional tests
49+
run: npm run test:functional
50+
51+
publish-gpr:
52+
needs: [test-unit, test-integration, test-functional]
53+
runs-on: ubuntu-latest
54+
permissions:
55+
packages: write
56+
contents: read
57+
steps:
58+
- uses: actions/checkout@v3
59+
- uses: actions/setup-node@v3
60+
with:
61+
node-version: 19
62+
registry-url: https://npm.pkg.github.com/
63+
64+
- name: Install npm dependencies
65+
run: npm ci
66+
67+
- name: Build package
68+
run: npm run build
69+
70+
- name: Update package version
71+
run: |
72+
# Fetch or initialize the version counter
73+
if [ ! -f .alpha_version ]; then
74+
echo "1" > .alpha_version
75+
fi
76+
INCREMENTAL_NUMBER=$(cat .alpha_version)
77+
78+
# Increment version number
79+
NEW_INCREMENTAL_NUMBER=$((INCREMENTAL_NUMBER+1))
80+
81+
# Save the new incremental number to the file
82+
echo "${NEW_INCREMENTAL_NUMBER}" > .alpha_version
83+
84+
# Update package version with 2.0.0.alpha.<incremental_number>
85+
NEW_VERSION="2.0.0.alpha.${INCREMENTAL_NUMBER}"
86+
npm version "${NEW_VERSION}" --no-git-tag-version
87+
88+
# Commit the version update and incremental number
89+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
90+
git config --global user.name "GitHub Actions"
91+
git add package.json .alpha_version
92+
git commit -m "Update version to ${NEW_VERSION}"
93+
94+
- name: Publish package
95+
run: |
96+
echo "$(jq '.publishConfig.registry = "https://npm.pkg.github.com"' package.json)" > package.json
97+
echo "$( jq '.name = "@IQSS/dataverse-client-javascript"' package.json )" > package.json
98+
npm publish --@IQSS:registry=https://npm.pkg.github.com
99+
env:
100+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)