-
Notifications
You must be signed in to change notification settings - Fork 8
121 lines (110 loc) · 4.85 KB
/
release-vscode-extension.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
# This action is triggered when tags of the form releases/vscode-smart-contracts/*.*.*
# are created. It will build cargo-concordium and vscode extension and upload it
# as artifacts of the workflow run. If a release already exists with the given
# tag then the extension will also be attached as assets to the release.
#
# The intended workflow is that a release is created and tagged, at which point
# this action will be triggered and complete the build.
name: 'Build and publish VSCode extension in a release'
on:
# This release action always requires a tag to publish a release.
# This job will run when a releases/vscode-smart-contracts/$VERSION
# tag is created.
push:
tags:
- releases/vscode-smart-contracts/*.*.*
jobs:
build-cargo-concordium:
name: build ${{ matrix.platform }}
strategy:
fail-fast: true
matrix:
platform: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Support longpaths on Windows
if: matrix.platform == 'windows-latest'
run: git config --system core.longpaths true
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@1.74
- name: Build on ubuntu
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get install -y musl-tools musl-dev
rustup target add x86_64-unknown-linux-musl
cargo build --release --manifest-path cargo-concordium/Cargo.toml --target x86_64-unknown-linux-musl
- name: Build on windows
if: matrix.platform == 'windows-latest'
run: cargo build --release --manifest-path cargo-concordium/Cargo.toml
- name: Build on macos
if: matrix.platform == 'macos-latest'
run: |
# Build ARM64
rustup target add aarch64-apple-darwin
cargo build --release --manifest-path cargo-concordium/Cargo.toml --target aarch64-apple-darwin
# Build x86_64 and rename it.
rustup target add x86_64-apple-darwin
cargo build --release --manifest-path cargo-concordium/Cargo.toml --target x86_64-apple-darwin
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: binary-${{ matrix.platform }}
path: |
cargo-concordium/target/aarch64-apple-darwin/release/cargo-concordium
cargo-concordium/target/x86_64-apple-darwin/release/cargo-concordium
cargo-concordium/target/x86_64-unknown-linux-musl/release/cargo-concordium
cargo-concordium/target/release/cargo-concordium.exe
build-extension:
needs: build-cargo-concordium
runs-on: ubuntu-latest
permissions:
contents: write # For uploading artifacts to a release
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/download-artifact@v4
- name: Build extension for all platforms
working-directory: ./vscode-smart-contracts
run: |
mkdir out
mkdir executables
echo "Install dependencies"
npm ci
echo "Mac x86_64 first"
mv ../binary-macos-latest/x86_64-apple-darwin/release/cargo-concordium executables/cargo-concordium
chmod +x executables/cargo-concordium
npx vsce package --target darwin-x64 --out ./out/extension-darwin-x64.vsix
echo "Then Mac ARM64"
rm -rf executables/*
mv ../binary-macos-latest/aarch64-apple-darwin/release/cargo-concordium executables/cargo-concordium
chmod +x executables/cargo-concordium
npx vsce package --target darwin-arm64 --out ./out/extension-darwin-arm64.vsix
echo "Then Windows"
rm -rf executables/*
mv ../binary-windows-latest/release/cargo-concordium.exe executables/cargo-concordium.exe
npx vsce package --target win32-x64 --out ./out/extension-win64.vsix
echo "Finally linux"
rm -rf executables/*
mv ../binary-ubuntu-latest/x86_64-unknown-linux-musl/release/cargo-concordium executables/cargo-concordium
chmod +x executables/cargo-concordium
npx vsce package --target linux-x64 --out ./out/extension-linux-x64.vsix
- name: Upload extension artifacts
uses: actions/upload-artifact@v4
with:
name: extensions
path: |
vscode-smart-contracts/out/*.vsix
- name: Attach binaries to an existing release.
if: ${{ always() }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if gh release view ${{ github.ref_name }}; then
gh release upload ${{ github.ref_name }} vscode-smart-contracts/out/*.vsix
else
echo "::notice No release with ref name ${{ github.ref_name }}, so not uploading artifacts there."
fi