forked from casamagalhaes/node-printer
-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (82 loc) · 2.94 KB
/
publish.yml
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
name: Publish NPM CI
on:
release:
types: [created]
jobs:
build:
name: Prebuild Binaries for ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-13, windows-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
- name: Setup Dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo dpkg --add-architecture i386
sudo apt-get update -y -qq
sudo apt-get install -y g++-multilib gcc-multilib libcups2-dev libcups2-dev:i386 libc6-dev-i386 linux-libc-dev linux-libc-dev:i386
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: pip
- name: Install Python setup tools
run: pip install setuptools
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
registry-url: https://npm.pkg.github.com
scope: '@grupoboticario'
cache: npm
- run: npm ci
- name: Set release version
run: npm --no-git-tag-version version $TAG
env:
TAG: ${{ github.event.release.tag_name }}
- name: Apply patches
run: npm run apply-patches
- name: Build ${{ matrix.os }} binaries 32 bits
if: matrix.os != 'macos-13'
run: npm run prebuild -- --strip --arch ia32
- name: Build ${{ matrix.os }} binaries 64 bits
run: npm run prebuild -- --strip --arch x64
- name: Upload ${{ matrix.os }} binaries
if: matrix.os != 'windows-latest'
run: gh release upload ${{ github.event.release.tag_name }} prebuilds/**/*.tar.gz
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload ${{ matrix.os }} binaries
if: matrix.os == 'windows-latest'
run: gh release upload ${{ github.event.release.tag_name }} (ls prebuilds\*\*.tar.gz)
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
npm-publish:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
registry-url: https://npm.pkg.github.com
scope: '@grupoboticario'
cache: npm
- name: Bump release version
if: github.event.release.prerelease != true
run: |
echo "NEW_VERSION=$(npm --no-git-tag-version version $TAG)" >> "$GITHUB_ENV"
echo "RELEASE_TAG=latest" >> "$GITHUB_ENV"
env:
TAG: ${{ github.event.release.tag_name }}
- name: Bump pre-release version
if: github.event.release.prerelease == true
run: |
echo "NEW_VERSION=$(npm --no-git-tag-version --preid=beta version $TAG)" >> "$GITHUB_ENV"
echo "RELEASE_TAG=beta" >> "$GITHUB_ENV"
env:
TAG: ${{ github.event.release.tag_name }}
- run: npm publish --tag ${{ env.RELEASE_TAG }}
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}