-
Notifications
You must be signed in to change notification settings - Fork 8
144 lines (120 loc) · 5.16 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: Release Extensions
on:
push:
tags:
- "*"
jobs:
release:
runs-on: ubuntu-latest
# Gives access to the VSCE_PAT, OVSX_TOKEN secret
environment: vsce
permissions:
# Allows creation of releases
contents: write
outputs:
release_id: ${{ steps.create_release.outputs.id }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup
with:
kind: release
secret: ${{ secrets.GITHUB_TOKEN }}
- name: Install VSCode NPM Packages
working-directory: vscode
run: npm install
- name: Package VSCode Extension
working-directory: vscode
run: npm run package
- name: Publish to VSCode Marketplace
working-directory: vscode
run: npm run publish:vsce
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
- name: Publish to OpenVSX
working-directory: vscode
run: npm run publish:ovsx
env:
OPENVSX_PAT: ${{ secrets.OVSX_TOKEN }}
- name: Package Sublime Text Package
working-directory: sublime-text
run: zip pest.sublime-package *
- name: Publish to crates.io
working-directory: language-server
run: cargo publish --token ${{ secrets.CRATES_TOKEN }}
- name: Get Changelog
id: get_changelog
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "COMMITS<<$EOF" >> $GITHUB_OUTPUT
echo "COMMITS=\"$(awk -v latest="$(grep -Eo '^## v[0-9]+\.[0-9]+\.[0-9]+$' CHANGELOG.md | head -n1)" '/^## v/ {if (header) exit; header=1} /^## v'${latest}'/{print; next} header && !/^## v/{print}' CHANGELOG.md)\"" >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
name: ${{ github.ref_name }}
body: |
# Checklist Before Publishing
- [ ] Check [VSCode extension](https://marketplace.visualstudio.com/items?itemName=pest.pest-ide-tools) was published correctly.
- [ ] Check [OpenVSX extension](https://open-vsx.org/extension/pest/pest-ide-tools) was published correctly.
- [ ] Check [crates.io release](https://crates.io/crates/pest-language-server/versions) was published correctly.
- [ ] Check artifacts were uploaded to this release.
- [ ] Update release body.
${{ steps.get_changelog.outputs.COMMITS }}
draft: true
prerelease: false
files: |
vscode/pest.vsix
sublime-text/pest.sublime-package
build-binaries:
needs: release
runs-on: ${{ matrix.target.runner }}
permissions:
# So we can upload to the release
contents: write
strategy:
matrix:
target:
[
{ runner: "macos-14", target: "aarch64-apple-darwin", os: darwin, arch: aarch64 }, # Apple silicon
{ runner: "ubuntu-latest", target: "aarch64-unknown-linux-gnu", os: linux, arch: aarch64 },
{ runner: "macos-12", target: "x86_64-apple-darwin", os: darwin, arch: x86_64 }, # Intel Mac
{ runner: "ubuntu-latest", target: "x86_64-pc-windows-gnu", os: windows, arch: x86_64 }, # It's trivial to cross-compile to Windows (less so for Mac)
{ runner: "ubuntu-latest", target: "x86_64-unknown-linux-gnu", os: linux, arch: x86_64 },
]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup
uses: ./.github/actions/setup
with:
kind: release-compile-binaries
secret: ${{ secrets.GITHUB_TOKEN }}
rust-target: ${{ matrix.target.target }}
- name: Set up Windows
if: matrix.target.os == 'windows'
run: sudo apt-get install -y --no-install-recommends mingw-w64 musl-tools gcc-mingw-w64-x86-64-win32
- name: Set up aarch64 Linux
if: matrix.target.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get install gcc-aarch64-linux-gnu
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
- name: Build binary
run: cargo build --release --target=${{ matrix.target.target }}
- name: Package binary (Linux and Mac)
if: matrix.target.os != 'windows'
run: tar -zcvf pest-language-server-${{ matrix.target.os }}-${{ matrix.target.arch }}.tar.gz -C target/${{ matrix.target.target }}/release pest-language-server
- name: Package binary (Windows)
if: matrix.target.os == 'windows'
run: tar -zcvf pest-language-server-${{ matrix.target.os }}-${{ matrix.target.arch }}.tar.gz -C target/${{ matrix.target.target }}/release pest-language-server.exe
- uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: "./pest-language-server-${{ matrix.target.os }}-${{ matrix.target.arch }}.tar.gz"
release_id: ${{ needs.release.outputs.release_id }}