-
Notifications
You must be signed in to change notification settings - Fork 2
109 lines (98 loc) · 3.17 KB
/
publish.yaml
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
name: publish
on:
push:
tags:
- "v*"
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
target:
- x86_64-unknown-linux-musl
- x86_64-apple-darwin
- aarch64-apple-darwin
- x86_64-pc-windows-msvc
toolchain: [stable]
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
platform: linux
arch: x64
use-cross: true
- os: macos-latest
target: x86_64-apple-darwin
platform: darwin
arch: x64
use-cross: false
- os: macos-11
target: aarch64-apple-darwin
platform: darwin
arch: arm64
use-cross: false
- os: windows-latest
target: x86_64-pc-windows-msvc
platform: win32
arch: x64
use-cross: false
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
target: ${{ matrix.target }}
override: true
default: true
profile: minimal
- uses: actions/setup-node@v2
with:
node-version: 14.x
- name: Handle Rust dependencies caching
uses: Swatinem/rust-cache@v2
with:
key: v1-${{ matrix.target }}
- name: Build release binary
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target ${{ matrix.target }}
use-cross: ${{ matrix.use-cross }}
- run: yarn install --frozen-lockfile
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: editor/code
- shell: bash
run: echo "target=${{ matrix.platform }}-${{ matrix.arch }}" >> "$GITHUB_ENV"
- shell: bash
run: |
if [ "${{ matrix.os }}" = "windows-latest" ]; then
mkdir -p "../../target/${{ matrix.target }}/release"
touch "../../target/${{ matrix.target }}/release/glas.exe"
cp "../../target/${{ matrix.target }}/release/glas.exe" "./glas.exe"
else
mkdir -p "../../target/${{ matrix.target }}/release"
touch "../../target/${{ matrix.target }}/release/glas"
cp "../../target/${{ matrix.target }}/release/glas" "./glas"
fi
working-directory: editor/code
- run: npx vsce package --target ${{ env.target }} -o "./glas-${{ env.target }}.vsix"
working-directory: editor/code
- uses: actions/upload-artifact@v2
with:
name: glas-${{ env.target }}
path: "editor/code/*.vsix"
publish:
runs-on: ubuntu-latest
needs: build
if: success() && startsWith( github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v2
- run: npx vsce publish --packagePath $(find . -iname *.vsix)
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
- run: npx ovsx publish --packagePath $(find . -iname *.vsix)
timeout-minutes: 2
env:
OVSX_PAT: ${{ secrets.OPENVSX_PAT}}