-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update github actions. one for testing and another for automatically …
…making a release from tags
- Loading branch information
1 parent
c9aa717
commit 58d9222
Showing
2 changed files
with
83 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: Make a release | ||
|
||
on: | ||
workflow_dispatch: # can be triggered manually | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
pull_request: # and for PRs (dry-run) | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
|
||
Release: | ||
|
||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
|
||
- uses: actions/checkout@v3 | ||
name: Checkout repository | ||
|
||
|
||
- name: Set version string to the commit hash | ||
run: echo "RELEASE_VERSION=${{ github.sha }}" >> "$GITHUB_ENV" | ||
|
||
- name: Set version string based on trigger (ref_name if on tag) | ||
run: echo "RELEASE_VERSION=${{ github.ref_name }}" >> "$GITHUB_ENV" | ||
if: startsWith(github.ref, 'refs/tags/') | ||
|
||
- name: Set version string based on trigger (PR number if a PR) | ||
run: echo "RELEASE_VERSION=${{ github.event.pull_request.number }}" >> "$GITHUB_ENV" | ||
if: github.event_name == 'pull_request' | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.x | ||
|
||
- run: npm install | ||
|
||
- run: xvfb-run -a npm test | ||
|
||
- run: npm test | ||
|
||
- name: Publish | ||
if: success() && startsWith(github.ref, 'refs/tags/') | ||
run: npm run deploy | ||
env: | ||
VSCE_PAT: ${{ secrets.VSCE_PAT }} | ||
|
||
# See https://github.com/softprops/action-gh-release | ||
- name: Create Release | ||
id: create_release | ||
uses: softprops/action-gh-release@v1 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
name: ${RELEASE_VERSION} | ||
draft: false | ||
prerelease: false | ||
generate_release_notes: true |
28 changes: 15 additions & 13 deletions
28
.github/workflows/workflow.yaml → .github/workflows/test.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,32 @@ | ||
name: Run tests | ||
|
||
on: | ||
workflow_dispatch: # can be triggered manually | ||
push: | ||
branches: | ||
- main | ||
release: | ||
types: | ||
- created | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
|
||
Test: | ||
|
||
strategy: | ||
matrix: | ||
os: [macos-latest, ubuntu-latest, windows-latest] | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.x | ||
|
||
- run: npm install | ||
|
||
- run: xvfb-run -a npm test | ||
if: runner.os == 'Linux' | ||
|
||
- run: npm test | ||
if: runner.os != 'Linux' | ||
- name: Publish | ||
if: success() && startsWith(github.ref, 'refs/tags/') && matrix.os == 'ubuntu-latest' | ||
run: npm run deploy | ||
env: | ||
VSCE_PAT: ${{ secrets.VSCE_PAT }} |