Version Packages #28
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: Release | |
on: | |
push: | |
branches: [main] | |
paths: | |
- ".changeset/**" | |
- "packages/tw2panda/**" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
- name: Setup Node.js 18.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- name: Install pnpm | |
uses: pnpm/[email protected] | |
with: | |
version: 8 | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Build | |
working-directory: ./packages/tw2panda | |
run: pnpm build | |
- name: Test | |
working-directory: ./packages/tw2panda | |
run: pnpm test | |
# - name: Release to dev tag | |
# if: steps.changesets.outputs.published != 'true' | |
# run: | | |
# git checkout main | |
# pnpm changeset version --snapshot dev | |
# pnpm changeset publish --tag dev | |
# env: | |
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
# NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Release Pull Request or Publish to npm | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
publish: pnpm release | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
create_timestamp: | |
runs-on: ubuntu-latest | |
outputs: | |
timestamp: ${{ steps.set_timestamp.outputs.timestamp }} | |
steps: | |
- name: Set Timestamp | |
id: set_timestamp | |
run: | | |
echo "::set-output name=timestamp::$(date +'%s')" | |
release-extension: | |
name: VSCode Marketplace | |
needs: create_timestamp | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: windows-latest | |
target: win32-x64 | |
npm_config_arch: x64 | |
- os: windows-latest | |
target: win32-ia32 | |
npm_config_arch: ia32 | |
- os: windows-latest | |
target: win32-arm64 | |
npm_config_arch: arm | |
- os: ubuntu-latest | |
target: linux-x64 | |
npm_config_arch: x64 | |
- os: ubuntu-latest | |
target: linux-arm64 | |
npm_config_arch: arm64 | |
- os: ubuntu-latest | |
target: linux-armhf | |
npm_config_arch: arm | |
- os: ubuntu-latest | |
target: alpine-x64 | |
npm_config_arch: x64 | |
- os: macos-latest | |
target: darwin-x64 | |
npm_config_arch: x64 | |
- os: macos-latest | |
target: darwin-arm64 | |
npm_config_arch: arm64 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: pnpm/[email protected] | |
with: | |
version: 8 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
registry-url: "https://registry.npmjs.org" | |
cache: "pnpm" | |
- name: Setup Git User | |
shell: bash | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "Alexandre Stahmer" | |
- name: Install dependencies | |
shell: bash | |
run: pnpm install --frozen-lockfile | |
- name: Build packages | |
run: pnpm build | |
- name: Set Environment Variable | |
run: echo "VSCE_RELEASE_VERSION=$(date +'%s')" >> $GITHUB_ENV | |
- name: Overrides esbuild | |
working-directory: ./packages/vscode | |
if: contains(matrix.target, 'darwin-arm64') | |
run: pnpm override-esbuild | |
- name: Rewrite workspace deps | |
working-directory: ./packages/vscode | |
run: pnpm rewrite-deps | |
- name: Clean node_modules on windows | |
working-directory: ./packages/vscode | |
if: contains(matrix.target, 'win') | |
run: pnpm clean:windows | |
- name: Clean node_modules | |
working-directory: ./packages/vscode | |
if: "!(contains(matrix.target, 'win'))" | |
run: pnpm clean | |
- name: Install with workspace-less | |
working-directory: ./packages/vscode | |
run: | | |
pnpm i --ignore-scripts --ignore-workspace --shamefully-hoist --force | |
env: | |
npm_config_arch: ${{ matrix.npm_config_arch }} | |
- name: Publish RC | |
working-directory: ./packages/vscode | |
run: | | |
pnpm release | |
env: | |
VSCE_TOKEN: ${{secrets.VSCE_TOKEN}} | |
VSCE_RELEASE_VERSION: ${{ needs.create_timestamp.outputs.timestamp }} | |
VSCE_RELEASE_TYPE: stable | |
VSCE_TARGET: ${{ matrix.target }} |