Package vscode extension #4
Workflow file for this run
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
name: Package vscode extension | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'yamlfmt version' | |
type: string | |
#renovate: datasource=github-releases depName=google/yamlfmt | |
default: v0.13.0 | |
workflow_call: | |
inputs: | |
version: | |
description: 'yamlfmt version' | |
type: string | |
#renovate: datasource=github-releases depName=google/yamlfmt | |
default: v0.13.0 | |
env: | |
# TODO: Renovate node version to match the package version | |
node_version: 20 | |
jobs: | |
validations: | |
name: Validations | |
runs-on: ubuntu-latest | |
outputs: | |
VERSION_NUM: ${{ steps.strip.outputs.VERSION_NUM }} | |
steps: | |
- name: Validate version string | |
run: | | |
if [[ ! ${{ inputs.version }} =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
echo "Invalid version string. Please provide a valid version string in the format v1.2.3" | |
exit 1 | |
fi | |
- name: Strip v from version | |
id: strip | |
run: | | |
version=${{ inputs.version }} | |
echo "VERSION_NUM=${version/v/}" >> $GITHUB_OUTPUT | |
package: | |
name: Package vscode extension | |
runs-on: ubuntu-latest | |
needs: validations | |
strategy: | |
matrix: | |
os: | |
- os: win32-x64 | |
bin: Windows_x86_64 | |
- os: win32-arm64 | |
bin: Windows_arm64 | |
- os: linux-x64 | |
bin: Linux_x86_64 | |
- os: linux-arm64 | |
bin: Linux_arm64 | |
- os: darwin-x64 | |
bin: Darwin_x86_64 | |
- os: darwin-arm64 | |
bin: Darwin_arm64 | |
steps: | |
- name: Checkout extension repo | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
with: | |
fetch-depth: 0 | |
- name: Download yamlfmt binaries from release | |
uses: robinraju/[email protected] | |
with: | |
repository: google/yamlfmt | |
tag: ${{ inputs.version }} | |
fileName: 'yamlfmt_${{ needs.validations.outputs.VERSION_NUM }}_${{ matrix.os.bin }}.tar.gz' | |
extract: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Cleanup bin | |
run: | | |
rm -rf bin/ | |
rm -rf yamlfmt_*.tar.gz | |
mkdir bin | |
mv yamlfmt* bin/ | |
chmod +x -R bin/ | |
- name: Setup nodejs | |
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4 | |
with: | |
node-version: ${{ env.node_version }} | |
- name: Npm install | |
run: npm install | |
- name: Package ${{ matrix.os.os }} extension | |
shell: bash | |
run: npx vsce package --target ${{ matrix.os.os }} | |
- name: Upload artifacts (vsix files) | |
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4 | |
with: | |
path: "*.vsix" |