Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add swc update workflow #32

Merged
merged 2 commits into from
Aug 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .github/workflows/update-swc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Update SWC and Build WASM

on:
workflow_dispatch:
inputs:
swc_version:
description: 'SWC version to update to (e.g., 1.7.5)'
required: false
schedule:
- cron: '0 0 * * 1' # Every Monday at 00:00 UTC

env:
NODE_VERSION: lts/*

jobs:
update-swc:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4

- name: Get latest SWC version
id: check-swc-version
run: |
SWC_VERSION=$(npm view @swc/core version)
echo "SWC_VERSION=$SWC_VERSION" >> $GITHUB_OUTPUT

- name: Get current SWC version
run: |
SWC_VERSION=$(cat lib/swc/package.json | jq -r '.version')
echo "SWC_VERSION=$SWC_VERSION" >> $GITHUB_ENV
if [[ $SWC_VERSION == ${{ steps.check-swc-version.outputs.SWC_VERSION }} ]]; then
echo "SWC is already up-to-date. Exiting."
exit 0
fi
- name: Git config
run: |
marco-ippolito marked this conversation as resolved.
Show resolved Hide resolved
git config --global user.email "github-bot@iojs.org"
git config --global user.name "Node.js GitHub Bot"

- name: Update SWC
run: |
./tools/update-swc.sh
git add deps
git commit -m "chore: update swc to v${{ github.event.inputs.swc_version || steps.check-swc-version.outputs.SWC_VERSION }}"

- name: Set up Docker
uses: docker/setup-buildx-action@v3

- name: Build WASM
run: |
node ./tools/build-wasm.js
git add lib
git commit -m "chore: build wasm from swc v${{ github.event.inputs.swc_version || steps.check-swc-version.outputs.SWC_VERSION }}"

- name: Create Pull Request
uses: gr2m/create-or-update-pull-request-action@v1.9.4
with:
author: Node.js GitHub Bot <github-bot@iojs.org>
body: "This PR updates SWC to version ${{ github.event.inputs.swc_version || steps.check-swc-version.outputs.SWC_VERSION }} and rebuilds the WASM file."
branch: "chore/update-swc-${{ github.event.inputs.swc_version || steps.check-swc-version.outputs.SWC_VERSION }}"
title: "chore(deps): update SWC to v${{ github.event.inputs.swc_version || steps.check-swc-version.outputs.SWC_VERSION }}"