-
Notifications
You must be signed in to change notification settings - Fork 7
129 lines (121 loc) · 4.12 KB
/
release.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
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
128
129
name: release
on:
release:
types: [published]
workflow_dispatch:
jobs:
wait:
runs-on: ubuntu-latest
steps:
- name: Wait for checks to succeed
uses: poseidon/wait-for-status-checks@v0.4.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
interval: 5
dist:
strategy:
# don't cancel other jobs when one fails
fail-fast: false
matrix:
include:
- os: windows-latest
target: x86_64-pc-windows-msvc
code-target: win32-x64
- os: windows-latest
target: aarch64-pc-windows-msvc
code-target: win32-arm64
- os: ubuntu-20.04
target: x86_64-unknown-linux-gnu
code-target: linux-x64
- os: ubuntu-20.04
target: x86_64-unknown-linux-musl
code-target: linux-x64
- os: ubuntu-20.04
target: aarch64-unknown-linux-gnu
code-target: linux-arm64
- os: ubuntu-20.04
target: arm-unknown-linux-gnueabihf
code-target: linux-armhf
- os: macos-latest
target: x86_64-apple-darwin
code-target: darwin-x64
- os: macos-latest
target: aarch64-apple-darwin
code-target: darwin-arm64
name: dist (${{ matrix.target }})
runs-on: ${{ matrix.os }}
needs: wait
steps:
- uses: actions/checkout@v4
# needed for arm targets
- name: Install Rust
uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- name: Install GCC arm64 (linux)
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: sudo apt-get update && sudo apt-get install gcc-aarch64-linux-gnu
- name: Install GCC armhf (linux)
if: matrix.target == 'arm-unknown-linux-gnueabihf'
run: sudo apt-get update && sudo apt-get install gcc-arm-linux-gnueabihf
- run: cargo build --target ${{ matrix.target }} --release
- run: npm ci
- name: vsce package
# use bash on windows
shell: bash
run: |
mkdir -p bundled dist
cp target/${{ matrix.target }}/release/typos-lsp* bundled/
npx vsce package -o dist/ --target ${{ matrix.code-target }}
- name: Archive
shell: bash
run: |
ver=${GITHUB_REF/refs\/*\//}
archive="typos-lsp-$ver-${{ matrix.target }}"
if [ "${{ matrix.os }}" == "windows-latest" ]; then
7z a "dist/${archive}.zip" target/${{ matrix.target }}/release/typos-lsp.exe
else
tar czf "dist/${archive}.tar.gz" -C target/${{ matrix.target }}/release typos-lsp
fi
ls -al dist/*
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: dist
- name: Start sshx session on failed manual attempt
if: ${{ failure() && (github.event_name == 'workflow_dispatch' || github.run_attempt > 1) }}
run: curl -sSf https://sshx.io/get | sh && sshx
publish:
runs-on: ubuntu-latest
needs: dist
permissions:
contents: write
steps:
- uses: actions/checkout@v4
# download each artifact into its own self-named directory
- uses: actions/download-artifact@v4
with:
path: dist
- run: npm ci
- name: Inspect dist
run: |
ls -al dist/*
npx glob dist/**/*.vsix
- name: vsce publish
run: npx vsce publish --packagePath $(npx glob dist/**/*.vsix)
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
- name: ovsx publish
run: npx ovsx publish --packagePath $(npx glob dist/**/*.vsix)
env:
OVSX_PAT: ${{ secrets.OVSX_PAT }}
- name: Upload to GH release
uses: softprops/action-gh-release@v2
with:
files: dist/**/*
- name: Start sshx session on failed manual attempt
if: ${{ failure() && (github.event_name == 'workflow_dispatch' || github.run_attempt > 1) }}
run: curl -sSf https://sshx.io/get | sh && sshx