Skip to content

Commit

Permalink
ci: introduce build_tag.yml to build and deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
mbehr1 committed Apr 23, 2022
1 parent 8650f02 commit b6cf392
Show file tree
Hide file tree
Showing 5 changed files with 149 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: build
on:
push:
branches:
- "**"
tags:
- "v*"
- "ci/**"
# tags:
# - "v*"

jobs:
build:
Expand Down
79 changes: 79 additions & 0 deletions .github/workflows/build_tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: build_tag
on:
workflow_call:
inputs:
tagname:
required: true
type: string

jobs:
build:
strategy:
matrix:
include:
- os: windows-latest
platform: win32
arch: x64
npm_config_arch: x64
- os: windows-latest
platform: win32
arch: ia32
npm_config_arch: ia32
# - os: windows-latest
# platform: win32
# arch: arm64
# npm_config_arch: arm
- os: ubuntu-latest
platform: linux
arch: x64
npm_config_arch: x64
- os: ubuntu-latest
platform: linux
arch: arm64
npm_config_arch: arm64
# - os: ubuntu-latest
# platform: linux
# arch: armhf
# npm_config_arch: arm
- os: ubuntu-latest
platform: alpine
arch: x64
npm_config_arch: x64
- os: macos-latest
platform: darwin
arch: x64
npm_config_arch: x64
- os: macos-latest
platform: darwin
arch: arm64
npm_config_arch: arm64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{ inputs.tagname }}
- uses: actions/setup-node@v2
with:
node-version: 14.x
- run: npm install
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
npm_config_arch: ${{ matrix.npm_config_arch }}
- run: npx vsce --version
- shell: pwsh
run: echo "target=${{ matrix.platform }}-${{ matrix.arch }}" >> $env:GITHUB_ENV
- run: npx vsce package --target ${{ env.target }}
- uses: actions/upload-artifact@v2
with:
name: ${{ env.target }}
path: "*.vsix"

publish:
runs-on: ubuntu-latest
needs: build
if: success()
steps:
- uses: actions/download-artifact@v2
- run: npx vsce publish --packagePath $(find . -iname *.vsix)
env:
VSCE_PAT: ${{ secrets.VSCE_TOKEN }}
25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
jobs:
release:
runs-on: ubuntu-latest
outputs:
NEXTVERSION: ${{ steps.relver.outputs.nextVer }}
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -20,7 +22,30 @@ jobs:
- name: Install dependencies
run: npm ci
- name: Release
id: relver
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VSCE_PAT: ${{ secrets.VSCE_TOKEN }}
run: npx semantic-release --debug
- name: print next version
run: echo NEXTVERSION= ${{ steps.relver.outputs.nextVer }}
- name: next version is valid
run: echo valid=${{ startsWith(steps.relver.outputs.nextVer, 'v') }}
#- name: Get new tag name
# id: get-latest-tag
# if: success()
# uses: actions-ecosystem/action-get-latest-tag@v1
# with:
# semver_only: true

buildAndDeploy:
#runs-on: ubuntu-latest
needs: release
if: "startsWith(needs.release.outputs.NEXTVERSION, 'v')"
#steps:
#- run: echo NEXTVERSION= ${{ needs.release.outputs.NEXTVERSION }}
#- run: echo valid=${{ startsWith(needs.release.outputs.NEXTVERSION, 'v') }}
uses: ./.github/workflows/build_tag.yml
with:
tagname: ${{ needs.release.outputs.NEXTVERSION }}

35 changes: 35 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,7 @@
"mocha": "^8.4.0",
"semantic-release": "^17.4.7",
"semantic-release-vsce": "^3.5.0",
"@semantic-release/exec": "^5.0.0",
"typescript": "^4.2.4",
"vscode-test": "^1.5.2"
},
Expand Down Expand Up @@ -847,6 +848,12 @@
{
"message": "chore(release): ${nextRelease.version}"
}
],
[
"@semantic-release/exec",
{
"publishCmd": "echo ::set-output name=nextVer::${nextRelease.version}"
}
]
],
"preset": "conventionalcommits"
Expand Down

0 comments on commit b6cf392

Please sign in to comment.