Skip to content

Commit 78c5c45

Browse files
committed
web publish github action
1 parent dd9191d commit 78c5c45

File tree

3 files changed

+44
-34
lines changed

3 files changed

+44
-34
lines changed

src/SDK/Language/Web.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ public function getFiles(): array
112112
],
113113
[
114114
'scope' => 'default',
115-
'destination' => '.travis.yml',
116-
'template' => 'web/.travis.yml.twig',
115+
'destination' => '.github/workflows/publish.yml',
116+
'template' => 'web/.github/workflows/publish.yml.twig',
117117
],
118118
[
119119
'scope' => 'enum',
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Publish to NPM
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
# Setup Node.js environment
16+
- name: Use Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '20.x'
20+
registry-url: 'https://registry.npmjs.org'
21+
22+
# Determine release tag based on the tag name
23+
- name: Determine release tag
24+
id: release_tag
25+
run: |
26+
if [[ "${{ '{{' }} github.ref {{ '}}' }}" == *"-rc"* ]] || [[ "${{ '{{' }} github.ref {{ '}}' }}" == *"-RC"* ]]; then
27+
echo "tag=next" >> "$GITHUB_OUTPUT"
28+
else
29+
echo "tag=latest" >> "$GITHUB_OUTPUT"
30+
fi
31+
32+
# Install dependencies (if any) and build your project (if necessary)
33+
- name: Install dependencies and build
34+
run: |
35+
npm install
36+
npm run build
37+
38+
# Publish to NPM with the appropriate tag
39+
- name: Publish
40+
run: npm publish --tag ${{ '{{' }} steps.release_tag.outputs.tag {{ '}}' }}
41+
env:
42+
NODE_AUTH_TOKEN: ${{ '{{' }} secrets.NPM_TOKEN {{ '}}' }}

templates/web/.travis.yml.twig

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)