-
Notifications
You must be signed in to change notification settings - Fork 1
127 lines (121 loc) · 4.02 KB
/
onRelease.yml
File metadata and controls
127 lines (121 loc) · 4.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: publish on release
on:
release:
types: [released]
permissions:
contents: write
jobs:
package-installers:
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
command: pack macos
artifact_name: macos-pkg
artifact_path: cli/dist/**/*.pkg
- os: windows-latest
command: pack win --targets win32-x64
artifact_name: windows-installer
artifact_path: cli/dist/**/*.exe
- os: ubuntu-latest
command: pack deb
artifact_name: linux-deb
artifact_path: cli/dist/**/*.deb
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- name: Configure pnpm linker for Windows packaging
if: ${{ matrix.os == 'windows-latest' }}
shell: pwsh
run: Set-Content -Path cli/.npmrc -Value "node-linker=hoisted"
- run: pnpm install --frozen-lockfile
- run: pnpm run build
- name: Install Windows packaging dependencies
if: ${{ matrix.os == 'windows-latest' }}
run: choco install nsis.portable 7zip grep --no-progress -y
- name: Verify Windows packaging dependencies
if: ${{ matrix.os == 'windows-latest' }}
shell: pwsh
run: |
where.exe makensis
where.exe 7z
where.exe grep
- name: Build installer
run: pnpm -C cli exec oclif ${{ matrix.command }}
- name: Upload installer artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: ${{ matrix.artifact_path }}
package-tarballs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm run build
- name: Install 7-zip for packaging
run: |
sudo apt-get update
sudo apt-get install -y p7zip-full
- name: Build tarballs
run: pnpm -C cli exec oclif pack tarballs
- name: Upload tarball artifacts
uses: actions/upload-artifact@v4
with:
name: tarballs
path: |
cli/dist/**/*.tar.gz
cli/dist/**/*.tar.xz
- name: Upload tarballs to autoupdate host (S3)
if: ${{ secrets.AWS_ACCESS_KEY_ID != '' && secrets.AWS_SECRET_ACCESS_KEY != '' && secrets.AWS_REGION != '' }}
run: pnpm -C cli exec oclif upload tarballs --root cli --xz
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
publish-release-assets:
needs: [package-installers, package-tarballs]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
path: release-assets
- name: Upload assets to GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event.release.tag_name }}
files: |
release-assets/**/*.pkg
release-assets/**/*.exe
release-assets/**/*.deb
release-assets/**/*.tar.gz
release-assets/**/*.tar.xz
fail_on_unmatched_files: true
overwrite_files: true
publish-npm:
needs: [publish-release-assets]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm run build
- name: Publish @powersync/cli to npm
run: pnpm -C cli publish --no-git-checks --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}