Skip to content

Commit cb4fee8

Browse files
committed
chore(ci): first draft wip
1 parent acee341 commit cb4fee8

File tree

3 files changed

+63
-1
lines changed

3 files changed

+63
-1
lines changed

.github/workflows/lint.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
run: |
2020
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
2121
- name: Install linter
22-
run: make install-lint-tools
22+
run: task install-lint-tools
2323
- name: Run linter
2424
run: task lint
2525
lint-js:

.github/workflows/npm-publish.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: 🎁 NPM Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- v*.*
7+
8+
permissions:
9+
id-token: write # Required for OIDC token generation
10+
11+
concurrency:
12+
cancel-in-progress: true
13+
group: ${{ github.workflow }}-${{ github.ref_name }}
14+
15+
jobs:
16+
release:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- uses: actions/setup-node@v4
23+
with:
24+
node-version: 22
25+
cache: 'yarn'
26+
27+
- name: prepublish
28+
shell: bash
29+
run: |
30+
export VERSION=$(jq -r '.version' packages/sdk/package.json)
31+
cat <<< $(jq '.dependencies["@crossplane-js/libs"]="'$VERSION'"' packages/sdk/package.json) > packages/sdk/package.json
32+
33+
- name: extract npm tag
34+
id: npm-tag
35+
shell: bash
36+
run: |
37+
if [[ "$GITHUB_REF" == *"alpha"* ]]; then
38+
npm_tag="alpha"
39+
elif [[ "$GITHUB_REF" == *"beta"* ]]; then
40+
npm_tag="beta"
41+
else
42+
npm_tag="latest"
43+
fi
44+
echo "tag=$npm_tag" >> $GITHUB_OUTPUT
45+
46+
- id: publish-sdk
47+
uses: JS-DevTools/npm-publish@v2
48+
with:
49+
token: ${{ secrets.NPM_TOKEN }}
50+
package: packages/sdk/package.json
51+
tag: ${{ steps.npm-tag.outputs.tag }}
52+
53+
- if: steps.publish-sdk.outputs.type
54+
run: |
55+
echo "Version changed: ${{ steps.publish-sdk.outputs.old-version }} => ${{ steps.publish-sdk.outputs.version }}"
56+

Taskfile.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ tasks:
4343
- "rm -f bin/xfuncjs-server"
4444
- "{{.GO}} clean"
4545

46+
# Install linter
47+
install-lint-tools:
48+
desc: Install linter tools
49+
cmds:
50+
- go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
51+
4652
# Lint
4753
lint:
4854
desc: Lint go code

0 commit comments

Comments
 (0)