generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): automatically handle dist folder in PRs and releases (#285)
Co-authored-by: DerekRoberts <[email protected]>
- Loading branch information
1 parent
15681ec
commit 7369e5b
Showing
6 changed files
with
86 additions
and
31,766 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: Merge | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
paths: | ||
- 'src/**' | ||
- 'package-lock.json' | ||
- 'package.json' | ||
- 'tsconfig.json' | ||
- 'action.yml' | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
semantic-release: | ||
runs-on: ubuntu-22.04 | ||
outputs: | ||
tag: ${{ steps.changelog.outputs.tag }} | ||
version: ${{ steps.changelog.outputs.version }} | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.head_ref }} | ||
|
||
- name: Conventional Changelog Update | ||
uses: TriPSs/conventional-changelog-action@v5 | ||
id: changelog | ||
continue-on-error: true | ||
with: | ||
github-token: ${{ github.token }} | ||
output-file: 'CHANGELOG.md' | ||
skip-version-file: 'true' | ||
skip-commit: 'true' | ||
skip-on-empty: 'false' | ||
git-push: 'true' | ||
|
||
- uses: actions/[email protected] | ||
with: | ||
node-version: 20.x | ||
|
||
- name: Rebuild the dist/ directory | ||
run: npm run dist | ||
|
||
- name: Git add dist/ | ||
run: git add dist/ lib/ -f | ||
|
||
- name: Create Release | ||
uses: softprops/action-gh-release@v2 | ||
if: ${{ steps.changelog.outputs.version != '' }} | ||
continue-on-error: true | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
token: ${{ github.token }} | ||
tag_name: ${{ steps.changelog.outputs.tag }} | ||
name: ${{ steps.changelog.outputs.tag }} | ||
body: ${{ steps.changelog.outputs.clean_changelog }} | ||
|
||
|
||
- name: Create Release | ||
uses: softprops/action-gh-release@v2 | ||
if: ${{ steps.changelog.outputs.version != '' }} | ||
continue-on-error: true | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
token: ${{ github.token }} | ||
tag_name: ${{ steps.changelog.outputs.tag.split('.')[0] }} | ||
name: ${{ steps.changelog.outputs.tag }} | ||
body: ${{ steps.changelog.outputs.clean_changelog }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,23 @@ | ||
name: PR | ||
on: | ||
pull_request: | ||
push: | ||
branches: [main] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
check-dist: | ||
name: Check dist/ | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/[email protected] | ||
with: | ||
node-version: 20.x | ||
|
||
- name: Rebuild the dist/ directory | ||
run: | | ||
npm ci | ||
npm run build | ||
npm run package | ||
- name: Compare the expected and actual dist/ directories | ||
run: | | ||
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then | ||
echo "Detected uncommitted changes after build. See status below:" | ||
git diff | ||
exit 1 | ||
fi | ||
test: | ||
name: Test Action | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'pull_request' | ||
permissions: | ||
pull-requests: write | ||
steps: | ||
# Rebuild ./dist | ||
- uses: actions/checkout@v4 | ||
- uses: actions/[email protected] | ||
with: | ||
node-version: 20.x | ||
- name: Rebuild the dist/ directory | ||
run: npm run dist | ||
|
||
# Test action | ||
- uses: ./ | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
@@ -48,10 +29,9 @@ jobs: | |
[Links!](https://google.ca) | ||
`Code!` | ||
# Test with different inputs | ||
- uses: ./ | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
limit_to_pr_opened: true | ||
add_markdown: | | ||
--- | ||
|
Oops, something went wrong.