Skip to content

Commit

Permalink
feat: add update sdk action (#26)
Browse files Browse the repository at this point in the history
Add a reusable workflow to automatically update SDK packages for a given
list of packages.

| Action  | Result |
| ----- | ------- |
| <img width="575" alt="Screenshot 2024-03-18 at 19 36 08"
src="https://github.com/FuelLabs/fuels-wallet/assets/7074983/3afef33a-dac6-4bfd-b6b2-79e9438e0b2e">
| <img width="890" alt="Screenshot 2024-03-18 at 20 06 08"
src="https://github.com/FuelLabs/github-actions/assets/7074983/63e23cd0-2194-4dbf-8f71-9a5d054fcd04">
|




### How to use?

```yaml
- uses: FuelLabs/github-actions/update-sdk@master
  with:
    branch: master # In case you want to use a different head branch, default is "main"
    packages: |
      @fuels
      @fuels/react
      @fuels/connectors
    npm-tag: latest # You might use "latest" or anything else
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
  • Loading branch information
helciofranco authored Mar 19, 2024
1 parent 4ecbe2f commit 6be7065
Show file tree
Hide file tree
Showing 13 changed files with 1,647 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/next-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
task_name: SPCheck

check-doc-folders:
name: Check Configs, Components, & Folders
name: Check Configs, Components & Folders
runs-on: ubuntu-latest
steps:
- name: Checkout repo
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ Repoistory to host all of Fuel's reusable workflows

| Group | Description |
| --------------------------------- | ---------------------------------------------------------------- |
| [changeset](./changeset/) | Reusable workflow for create changesets and release npm packages |
| [gh-projects](./gh-projects/) | Automating interactions between GH Projects and repositories |
| [setups/node](./setups/node/) | Setup node and pnpm requirements on CI |
| [setups/docker](./setups/docker/) | Setup docker and docker compose on CI |
| [setups/npm](./setups/npm/) | Setup npm deployment requirements on CI |
| [changeset](./changeset/) | Reusable workflow for create changesets and release npm packages |
| [update-sdk](./update-sdk/) | Reusable workflow for update the SDK packages |

## License

Expand Down
37 changes: 37 additions & 0 deletions update-sdk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
### Overview

A github action to update the SDK packages.

### How to use?

```yml
- uses: FuelLabs/github-actions/update-sdk@master
with:
repository: ${{ github.repository }} # You can omit it
branch: master # In case you want to use a different head branch (default: main)
npm-tag: ${{ matrix.tag }} # You might use "latest" or anything else, like a matrix strategy
# Remember they need to have the same tag name, otherwise it'll fail
packages: |
@fuels
@fuels/react
@fuels/connectors
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
### Inputs
| Name | Description | Default |
| ------------ | ---------------------------------------------------------- | -------------------------- |
| repository | Github Repository | `${{ github.repository }}` |
| branch | The branch that will be used to create the PR | `main` |
| packages | Packages to update (multiline input) | '' |
| npm-tag | NPM tag (e.g. latest or next) | `latest` |

### Outputs

No outputs defined

## License

The primary license for this repo is `Apache 2.0`, see [`LICENSE`](../LICENSE.md).
20 changes: 20 additions & 0 deletions update-sdk/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "SDK Outdated"
description: "Reusable workflow for update the SDK packages"

inputs:
repository:
description: "Github Repository"
default: ${{ github.repository }}
branch:
description: "The head branch that will be used to create the PR"
default: main
npm-tag:
description: "NPM tag (e.g. latest or next)"
default: latest
packages:
description: "Packages to update"
required: true

runs:
using: "node20"
main: "dist/index.js"
83 changes: 83 additions & 0 deletions update-sdk/dist/index.js

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions update-sdk/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "update-sdk",
"private": true,
"license": "Apache-2.0",
"main": "./src/index.ts",
"scripts": {
"ts:check": "tsc --noEmit",
"build": "tsup",
"dev": "tsx src/index.ts"
},
"devDependencies": {
"@fuels/ts-config": "0.17.0",
"@types/node": "20.11.29",
"chalk": "5.3.0",
"execa": "8.0.1",
"tsup": "8.0.2",
"tsx": "4.7.1"
},
"dependencies": {
"@actions/core": "1.10.1"
}
}
Loading

0 comments on commit 6be7065

Please sign in to comment.