Skip to content

Commit

Permalink
feat!: migrate to node20 and action-docs 2.0.0 (#407)
Browse files Browse the repository at this point in the history
  • Loading branch information
npalm authored Feb 7, 2024
1 parent b62a69e commit de57bfe
Show file tree
Hide file tree
Showing 9 changed files with 41,360 additions and 10,900 deletions.
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ updates:
directory: '/'
# Check the npm registry for updates every day (weekdays)
schedule:
interval: 'daily'
interval: 'weekly'
commit-message:
prefix: 'fix'
prefix-development: 'chore'
Expand All @@ -16,4 +16,4 @@ updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
interval: "weekly"
103 changes: 50 additions & 53 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ on:
push:
branches:
- main
- develop
pull_request:


Expand All @@ -13,17 +12,20 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [16, 18]
node-version: [20]
permissions:
pull-requests: write
contents: write

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # ratchet:actions/checkout@v3
- uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # ratchet:actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
node-version: 20

# build and test action
- name: Install dependencies
run: yarn install --ignore-engines
run: yarn install --frozen-lockfile

- name: Check format and lint
run: yarn run format-check && yarn lint
Expand All @@ -32,57 +34,52 @@ jobs:
run: yarn build && yarn run package

- name: Update docs
uses: './'
- run: cat README.md
uses: './'

- name: Update dist in the repository
if: github.ref != 'refs/heads/main'

- name: Check for modified files
id: changes
if: matrix.node-version == 18
run: |
echo "files=$(git ls-files -m)" >>$GITHUB_OUTPUT
echo "count=$(git ls-files -m | wc -l)" >>$GITHUB_OUTPUT
uses: stefanzweifel/git-auto-commit-action@8756aa072ef5b4a080af5dc8fef36c5d586e521d # ratchet:stefanzweifel/git-auto-commit-action@v5.0.0
with:
commit_message: 'chore(ci): Updating dist and docs'
file_pattern: 'dist/* README.md'

- uses: actions/github-script@v6.3.3
if: github.event_name == 'pull_request' && steps.changes.outputs.count != 0 && matrix.node-version == 18
- name: Create Pull Request (main branch only)
if: github.ref == 'refs/heads/main'
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # ratchet:peter-evans/create-pull-request@v5.0.2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const output = `#### Changes detected
Please verify you have updated the files below.
<details><summary>The following files are changed during the build</summary>
\`\`\`${{ steps.changes.outputs.files }}\`\`\`
</details>
*Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`, Workflow: \`${{ github.workflow }}\`*`;
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
})
- name: Update dist in the repository
if: github.event_name != 'pull_request' && matrix.node-version == 18
uses: stefanzweifel/git-auto-commit-action@v4.16.0
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'chore(ci): Updating dist and docs'
title: 'chore(ci): Updating dist and docs'
branch: update-docs
branch-suffix: random
base: ${{ github.event.pull_request.base.ref }}
delete-branch: true

release:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: build
runs-on: ubuntu-latest

steps:
- name: Get app installation token
uses: npalm/action-app-token@dd4bb16d91ced5659bc618705c96b822c5a42136 # v1.1.0
id: app-token
with:
commit_message: "chore(ci): Updating dist"
file_pattern: dist/*
appId: ${{ vars.APP_ID }}
appPrivateKeyBase64: ${{ secrets.APP_PRIVATE_KEY_BASE64 }}
appInstallationType: repo
appInstallationValue: ${{ github.repository }}

- name: Update readme in the repository
if: github.event_name != 'pull_request' && matrix.node-version == 18
uses: stefanzweifel/git-auto-commit-action@v4.16.0
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # ratchet:actions/checkout@v3
with:
commit_message: "chore(ci): Updating README"
file_pattern: README.md
fetch-depth: 0

- name: Release
if:
contains('
refs/heads/main
', github.ref) && matrix.node-version == 18
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: yarn release
uses: google-github-actions/release-please-action@e0b9d1885d92e9a93d5ce8656de60e3b806e542c # ratchet:google-github-actions/release-please-action@v3
id: release
with:
token: ${{ steps.app-token.outputs.token }}
release-type: simple
next-version: v2.0.0
last-release-sha: b62a69e27ae389aa92b450f647d37409b9277bf0
22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The action will update you readme by replacing html comment tags. Add one of mor

- `description` : to add/update a section with a descriptions of the action
- `inputs`: to add/update a section with inputs of the action
- `outpus`: to add/update a section with outputs of the action
- `outputs`: to add/update a section with outputs of the action
- `runs`: : to add/update a section of the environment required to run.

In your workflow add the action, see below for the available parameters.
Expand All @@ -25,22 +25,26 @@ In your workflow add the action, see below for the available parameters.
The action will not commit any change, to ensure the changes are persisted you can use an action to [commit](https://github.com/stefanzweifel/git-auto-commit-action) or raise a [pull request](https://github.com/peter-evans/create-pull-request).
<!-- action-docs-inputs -->
<!-- action-docs-inputs action="action.yml" -->
## Inputs
| parameter | description | required | default |
| name | description | required | default |
| --- | --- | --- | --- |
| readme | Readme file to update. | `false` | README.md |
| actionFile | THe action definition file. | `false` | action.yml |
| tocLevel | TOC level used for the headers. | `false` | 2 |
| lineBreaks | Line breaks to be used in updated readme (LF|CR|CRLF). | `false` | LF |
| `readme` | <p>Readme file to update.</p> | `false` | `README.md` |
| `actionFile` | <p>THe action definition file.</p> | `false` | `action.yml` |
| `tocLevel` | <p>TOC level used for the headers.</p> | `false` | `2` |
| `lineBreaks` | <p>Line breaks to be used in updated readme (LF|CR|CRLF).</p> | `false` | `LF` |
<!-- action-docs-inputs action="action.yml" -->

<!-- action-docs-inputs -->


<!-- action-docs-runs -->
<!-- action-docs-runs action="action.yml" -->
## Runs

This action is a `node16` action.
This action is a `node20` action.
<!-- action-docs-runs action="action.yml" -->

<!-- action-docs-runs -->
## License

Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ inputs:
default: LF

runs:
using: 'node16'
using: 'node20'
main: 'dist/index.js'
Loading

0 comments on commit de57bfe

Please sign in to comment.