generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Want to try this flow.
- Loading branch information
Showing
15 changed files
with
299 additions
and
36 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,3 @@ | ||
# Contributing | ||
|
||
The repository is released under the MIT license, and follows a standard Github development process, using Github tracker for issues and merging pull requests into master. |
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,17 @@ | ||
--- | ||
name: Bug report | ||
about: Create a report to help us improve | ||
|
||
--- | ||
|
||
**Describe the bug** | ||
A clear and concise description of what the bug is. | ||
|
||
**Workflow** | ||
If applicable, provide a workflow file to help explain your problem. | ||
|
||
**Expected behavior** | ||
A clear and concise description of what you expected to happen. | ||
|
||
**Additional context** | ||
Add any other context about the problem here. |
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,17 @@ | ||
--- | ||
name: Feature request | ||
about: Suggest an idea for this project | ||
|
||
--- | ||
|
||
**Is your feature request related to a problem? Please describe.** | ||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] | ||
|
||
**Describe the solution you'd like** | ||
A clear and concise description of what you want to happen. | ||
|
||
**Describe alternatives you've considered** | ||
A clear and concise description of any alternative solutions or features you've considered. | ||
|
||
**Additional context** | ||
Add any other context or screenshots about the feature request here. |
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,14 @@ | ||
### Type of Change | ||
<!-- What type of change does your code introduce? --> | ||
- [ ] New feature | ||
- [ ] Bug fix | ||
- [ ] Documentation | ||
- [ ] Refactor | ||
- [ ] Chore | ||
|
||
### Resolves | ||
- Fixes #[Add issue number here.] | ||
|
||
### Describe Changes | ||
<!-- Describe your changes in detail, if applicable. --> | ||
_Describe what this Pull Request does_ |
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,12 @@ | ||
# if a push is made into any branch | ||
# this will build node_modules and typescript code | ||
name: Build | ||
on: [push, pull_request] | ||
jobs: | ||
# make sure we can build | ||
build: | ||
name: Build code | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: make run |
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,50 @@ | ||
# if a pr is made into master and any further pushes(syncronize) | ||
# this will run prettier every run and auto-commit back the code | ||
# then we will lint and report back any issues | ||
name: Lint | ||
on: | ||
pull_request: | ||
# TODO: CHANGE TO MASTER BRANCH | ||
branches: | ||
- develop | ||
jobs: | ||
# this will lint your code and return any problems to the pr | ||
lint_reviewdog: | ||
name: eslint and reviewdog | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Lint and report | ||
uses: reviewdog/action-eslint@v1 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
reporter: github-pr-review | ||
eslint_flags: 'src/**/*.ts' | ||
# check format and push changes if they exist | ||
format_check_push: | ||
name: prettier | ||
runs-on: ubuntu-latest | ||
# dont run this if pushed from bot or format_check succeeded | ||
needs: lint_reviewdog | ||
if: github.actor != 'trilom-bot' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.TRILOM_BOT_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
token: ${{ env.GITHUB_TOKEN }} | ||
repository: ${{ github.event.pull_request.head.repo.full_name }} | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
- run: make run | ||
- name: make run COMMAND=format-check code | ||
run: | | ||
make run COMMAND=format-check | ||
- name: make run COMMAND=format and push code if check failed | ||
if: failure() | ||
run: | | ||
make run COMMAND=format | ||
sudo make clean | ||
git config --local user.email "trilom-bot@trailmix.me" | ||
git config --local user.name "trilom-bot" | ||
git commit -m "Add format changes" -a | ||
git push https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.event.pull_request.head.repo.full_name }}.git HEAD:refs/heads/${{ github.event.pull_request.head.ref }} && exit 0 |
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,56 @@ | ||
# on push to releases/v1 run semantic release to push npm | ||
# then publish to github package repo | ||
# then push the incremented package.json to releases/v1 which will release to action marketplace | ||
name: Package and deploy release 🎉 | ||
on: | ||
push: | ||
# TODO: CHANGE TO releases/v1 | ||
branches: | ||
- test/v1 | ||
jobs: | ||
# if push to releases/v1 then increment package.json | ||
release_push: | ||
name: Increment and push package.json to release | ||
runs-on: ubuntu-latest | ||
# TODO: CHANGE TO releases/v1 BRANCH | ||
if: github.actor == 'trilom-bot' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
token: ${{ secrets.TRILOM_BOT_TOKEN }} | ||
- name: Semantic Release | ||
uses: cycjimmy/semantic-release-action@v2 | ||
id: semantic | ||
with: | ||
# TODO: CHANGE TO releases/v1 BRANCH | ||
branch: test/v1 | ||
extra_plugins: | | ||
@semantic-release/git | ||
@semantic-release/changelog | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
- name: Setup Node.js with GitHub Package Registry | ||
if: steps.semantic.outputs.new_release_published == 'true' | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12 | ||
registry-url: 'https://npm.pkg.github.com' | ||
scope: 'trilom' | ||
- name: Publish To GitHub Package Registry | ||
if: steps.semantic.outputs.new_release_published == 'true' | ||
run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ env.GITHUB_TOKEN }} | ||
- name: Commit release files | ||
if: steps.semantic.outputs.new_release_published == 'true' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.TRILOM_BOT_TOKEN }} | ||
# TODO: CHANGE TO releases/v1 BRANCH | ||
run: | | ||
git config --local user.email "trilom-bot@trailmix.me" | ||
git config --local user.name "trilom-bot" | ||
git commit -m "Bump release version 🎉" -a | ||
git push https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git HEAD:refs/heads/test/v${{steps.semantic.outputs.new_release_major_version}} | ||
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,26 @@ | ||
# on push to master this will build the production code and push to release | ||
name: Release Build | ||
on: | ||
push: | ||
# TODO: CHANGE TO MASTER BRANCH | ||
branches: | ||
- develop | ||
jobs: | ||
# if push to master then build for release, and push to releases/v1 branch | ||
release_build: | ||
name: Build and push to release branch | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.TRILOM_BOT_TOKEN }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
token: ${{ env.GITHUB_TOKEN }} | ||
- run: make run COMMAND=release RELEASE=TRUE | ||
- name: Push release files | ||
# TODO: CHANGE TO releases/v1 BRANCH | ||
run: | | ||
git config --local user.email "trilom-bot@trailmix.me" | ||
git config --local user.name "trilom-bot" | ||
git commit -m "Add release changes ⚙️" -a | ||
git push https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git HEAD:refs/heads/test/v${{steps.semantic.outputs.new_release_major_version}} |
23 changes: 14 additions & 9 deletions
23
.github/workflows/test_release.yml → .github/workflows/release_test.yml
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
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,26 +1,17 @@ | ||
name: "build-test" | ||
on: # rebuild any PRs and main branch changes | ||
# if a pr is made into master and any further pushes(syncronize) | ||
# this will run jest | ||
name: Test | ||
on: | ||
pull_request: | ||
push: | ||
# TODO: CHANGE TO MASTER BRANCH | ||
branches: | ||
- master | ||
- 'releases/*' | ||
|
||
- develop | ||
jobs: | ||
build: # make sure build/ci work properly | ||
# test with jest | ||
test: | ||
name: jest | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- run: | | ||
npm install | ||
npm run all | ||
test: # make sure the action works on a clean machine without building | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- run: | | ||
ls -la | ||
ls -la lib | ||
- uses: ./ | ||
with: | ||
githubToken: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: actions/checkout@v2 | ||
- run: make run | ||
- run: make run COMMAND=test |
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,37 @@ | ||
SHELL:=/bin/bash | ||
MKFILEPATH:=$(shell pwd) | ||
DOCKER:=node:12@sha256:454651174f54836571258a329788574cf6552bddfd1a7113e769bd9fc3776fe6 | ||
ifdef COMMAND | ||
CMD:=$(COMMAND) | ||
endif | ||
ifndef COMMAND | ||
CMD:=build | ||
endif | ||
ifdef RELEASE | ||
CI:=TRUE | ||
endif | ||
|
||
IGNORE:=printf '%s\n%s' '**/*' '!.gitignore' | ||
|
||
clean.files: | ||
rm -rf lib dist node_modules | ||
|
||
clean.create: | ||
mkdir lib dist node_modules && \ | ||
$(IGNORE) > lib/.gitignore && \ | ||
$(IGNORE) > dist/.gitignore && \ | ||
$(IGNORE) > node_modules/.gitignore | ||
|
||
clean: clean.files clean.create | ||
|
||
run: | ||
docker run \ | ||
--mount type=bind,source="$(MKFILEPATH)",target=/code \ | ||
$(DOCKER) \ | ||
/bin/sh -c 'cd /code && make .yarn COMMAND=$(CMD)' && \ | ||
if [ "$(CI)" = "TRUE" ]; then \ | ||
rm -rf dist/.gitignore && rm -rf /tmp/node_modules/.gitignore; \ | ||
fi | ||
|
||
.yarn: | ||
yarn $(CMD) |
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
Oops, something went wrong.