Skip to content

Commit

Permalink
test: ci
Browse files Browse the repository at this point in the history
  • Loading branch information
HinsonSIDAN committed Dec 9, 2024
1 parent 3a03199 commit 60bf48c
Showing 1 changed file with 57 additions and 1 deletion.
58 changes: 57 additions & 1 deletion .github/workflows/publish-vscode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
name: Publish Cardano Devkit VSCode Extension

on:
push:
pull_request:
types:
- closed
branches:
- main
release:
Expand Down Expand Up @@ -32,6 +34,60 @@ jobs:
if: runner.os == 'Linux'
- run: yarn test
if: runner.os != 'Linux'

check-version:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
outputs:
version-updated: ${{ steps.compare-versions.outputs.version-updated }}
steps:
- name: Checkout main branch at commit before merge
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.sha }}

- name: Get package version from main branch before merge
id: pre-merge-version
run: |
PRE_MERGE_VERSION=$(node -p "require('./vscode-extension/package.json').version")
- name: Checkout main branch at commit after merge
uses: actions/checkout@v4
with:
ref: "main"

- name: Get package version from main branch after merge
id: post-merge-version
run: |
POST_MERGE_VERSION=$(node -p "require('./vscode-extension/package.json').version")
- name: Compare versions
id: compare-versions
run: |
if [[ "${{ steps.pre-merge-version.outputs.pre_merge_version }}" != "${{ steps.post-merge-version.outputs.post_merge_version }}" ]]; then
echo "version-updated=true" >> "$GITHUB_OUTPUT"
else
echo "version-updated=false" >> "$GITHUB_OUTPUT"
fi
publish:
needs: [build, check-version]
if: needs.check-version.outputs.version-updated == 'true' || github.event_name == 'release'
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: vscode-extension
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18.x
- run: yarn install
- name: Publish
if: success() && startsWith(github.ref, 'refs/tags/') && matrix.os == 'ubuntu-latest'
run: yarn deploy
Expand Down

0 comments on commit 60bf48c

Please sign in to comment.