Skip to content

Commit

Permalink
Set extension version during release
Browse files Browse the repository at this point in the history
  • Loading branch information
matklad committed Mar 9, 2020
1 parent 5770fa7 commit bf3eef8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
with:
node-version: 12.x

- run: echo "::set-env name=TAG::$(date --iso)"
- run: echo "::set-env name=TAG::$(date --iso --utc)"
if: github.event_name == 'push'
- run: echo "::set-env name=TAG::nightly"
if: github.event_name == 'schedule'
Expand Down Expand Up @@ -108,4 +108,4 @@ jobs:
if: github.event_name == 'push'
working-directory: ./editors/code
# token from https://dev.azure.com/rust-analyzer/
run: npx vsce publish 0.1.$(date +%Y%m%d) --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ../../dist/rust-analyzer.vsix
run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath ../../dist/rust-analyzer.vsix
10 changes: 8 additions & 2 deletions xtask/src/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,21 @@ fn dist_client(nightly: bool) -> Result<()> {
let _restore =
Restore { path: package_json_path.clone(), contents: original_package_json.clone() };

let mut package_json = original_package_json.replace(r#""enableProposedApi": true,"#, r#""#);
let date = run!("date --utc +%Y%m%d")?;
let version_suffix = if nightly { "-nightly" } else { "" };

let mut package_json = original_package_json.replace(
r#""version": "0.2.20200211-dev""#,
&format!(r#""version": "0.1.{}{}""#, date, version_suffix),
);

if nightly {
package_json = package_json.replace(
r#""displayName": "rust-analyzer""#,
r#""displayName": "rust-analyzer nightly""#,
);
} else {
package_json = original_package_json.replace(r#""enableProposedApi": true,"#, r#""#);
package_json = package_json.replace(r#""enableProposedApi": true,"#, r#""#);
}
fs2::write(package_json_path, package_json)?;

Expand Down

0 comments on commit bf3eef8

Please sign in to comment.