Skip to content

Commit 79162b6

Browse files
committed
Release latest when new v* tag is pushed
1 parent 6449df2 commit 79162b6

3 files changed

Lines changed: 45 additions & 196 deletions

File tree

.github/workflows/ci.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,16 @@ on:
44
push:
55
branches:
66
- master
7+
tags:
8+
- 'v*.*.*'
9+
- '*.*.*'
710

811
jobs:
912
ci:
1013
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
id-token: write
1117
steps:
1218
- uses: actions/checkout@v6
1319

@@ -42,6 +48,7 @@ jobs:
4248
- uses: actions/setup-node@v6
4349
with:
4450
node-version: 'lts/*'
51+
registry-url: 'https://registry.npmjs.org'
4552

4653
- name: Install requirements
4754
run: npm ci
@@ -117,3 +124,41 @@ jobs:
117124
files: ./coverage/junit.xml
118125
disable_search: true
119126
verbose: true
127+
128+
- name: Archive build
129+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
130+
run: tar -czvf dist.tar.gz dist/
131+
132+
- name: Upload Artifacts (Version Tag)
133+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
134+
uses: ncipollo/release-action@v1
135+
with:
136+
artifacts: "dist.tar.gz,bin/cdd-ts.js,bin/cdd-ts.wasm,bin/typescript-go.wasm,bin/cdd-ts-javy.wasm,bin/cdd-ts-go-javy.wasm"
137+
allowUpdates: true
138+
replacesArtifacts: true
139+
140+
- name: Update latest tag
141+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
142+
env:
143+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
144+
run: |
145+
gh release delete latest --cleanup-tag -y || true
146+
git push origin :refs/tags/latest || true
147+
git tag -f latest ${{ github.sha }}
148+
git push -f origin latest
149+
150+
- name: Create Latest Release
151+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
152+
uses: ncipollo/release-action@v1
153+
with:
154+
tag: latest
155+
name: Latest Release
156+
artifacts: "dist.tar.gz,bin/cdd-ts.js,bin/cdd-ts.wasm,bin/typescript-go.wasm,bin/cdd-ts-javy.wasm,bin/cdd-ts-go-javy.wasm"
157+
allowUpdates: true
158+
replacesArtifacts: true
159+
160+
- name: Publish to npmjs
161+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
162+
run: npm publish --provenance --access public
163+
env:
164+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/publish.yml

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

.github/workflows/release.yml

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

0 commit comments

Comments
 (0)